Can't tab through Add in form

Can't tab through Add in form

Anonymous
Not applicable
940 Views
10 Replies
Message 1 of 11

Can't tab through Add in form

Anonymous
Not applicable
Morning All,

I've created a form using VB2008.NET, but can't tab through the text boxes. I've set the tab order, but when I run the addin, the tab key does nothing. Anyone any ideas why?

Cheers

Jon
0 Likes
941 Views
10 Replies
Replies (10)
Message 2 of 11

Anonymous
Not applicable
Do you have a control on your form that retains constant focus? Or a special control that hijacks the keypress routines and overrides the Tab key?
0 Likes
Message 3 of 11

Anonymous
Not applicable
I think you need to make Inventor the parent for your form. I've attached
some directions on how to do that.
--
Brian Ekins
Autodesk Inventor API Product Designer
http://blogs.autodesk.com/modthemachine
0 Likes
Message 4 of 11

Anonymous
Not applicable
Morning Peter and Brian,

Thanks for your responses.

As far am I'm aware, there's nothing hijacking anything. It's a new addin I'm doing, and haven't got that much code in yet. I've reviewed my code, and compared it with what Brian suggested and the two sections are identical. I tried running the form without the window wrapper and it made no difference. If necessary I can attach my project. There's not much to it at the moment - it's just the form and a bit of code behind. I had a similar problem with another addin I created, but that one tabbed randomly, and even after setting the tabs still didn't do what I expected.

I asked at DevLabs about it, but they did not have any idea how to overcome it, but had heard of it before.

Would I be better using WPFs as opposed to Windows Forms?

Cheers
0 Likes
Message 5 of 11

Anonymous
Not applicable
Brian,

I've copy&pasted your WindowWrapper utility class in VB.NET 2008 (in StandardAddInServer.vb or do I need to put it in its own class module?) and it tells me you are missing "End Class" (so I added it). Also, IntPtrClass is not defined. The line "Private _hwnd As IntPtrClass" should be "Private _hwnd As IntPtr" to go along with the other references to IntPtr? After making this changes, the code works.

I'm curious why there is an equal sign = in front on many words (=display, =method, =WindowWrapper, =create, =OnExecute, =ShowDialog, =by ,=and, =child, =the) in your attached file.
0 Likes
Message 6 of 11

Anonymous
Not applicable
Here is a cleaned up version
0 Likes
Message 7 of 11

Anonymous
Not applicable
Thanks Josh. I don't know what happened to mine. I thought an .rtf file
would be relatively safe.
--
Brian Ekins
Autodesk Inventor API Product Designer
http://blogs.autodesk.com/modthemachine

"Josh_Petitt" wrote in message news:6226110@discussion.autodesk.com...
Here is a cleaned up version
0 Likes
Message 8 of 11

jeff.pek
Community Manager
Community Manager
Hi -

Can you post the code that you're using to display the form?

Inventor has some problems with interfering with certain operations of .NET modeless dialogs, but modal dialogs usually work fine.

Thanks,
Jeff
0 Likes
Message 9 of 11

Anonymous
Not applicable
Morning Jeff,

Sorry for the delay in replying. I've been on my hols!

I've attached the whole project, rather than just some random bits of code (I wan't sure what you would want).

Hope this will help shed some light on what I'm doing wrong.

Thanks for your help

Jon.
0 Likes
Message 10 of 11

jeff.pek
Community Manager
Community Manager
Hi Jon -

I'm going to keep looking into why the tab key isn't working when the dialog is shown modelessly, BUT, I think you'd be better off using a modal approach to showing this dialog -- since that appears to be what you want anyway.

Instead of using the Show method, use ShowDialog, like this:

Using MyForm As New frmSaveBox
MyForm.ShowDialog(New WindowWrapper(m_inventorApplication.MainFrameHWND))
End Using

This will allow the tab key to work properly, along with the Cancel button (to close the dialog).

Hope this is helpful,
Jeff
Message 11 of 11

Anonymous
Not applicable
Hi Jeff,

You are a genius! It works like a treat.

Many thanks for you help.

Jon.
0 Likes