Community
Inventor Programming - iLogic, Macros, AddIns & Apprentice
Inventor iLogic, Macros, AddIns & Apprentice Forum. Share your knowledge, ask questions, and explore popular Inventor topics related to programming, creating add-ins, macros, working with the API or creating iLogic tools.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

spacebar pushes button

5 REPLIES 5
Reply
Message 1 of 6
Anonymous
284 Views, 5 Replies

spacebar pushes button

I must be doing something wrong as far as keeping my form on top or else I
have goofed something up in either the form or a textbox setting, but I
can't find anything wrong.

When I am typing in a textbox in my addin, and hit space, it starts another
session of my addin.

In the declerations section I have

Private WithEvents frmNewForm As frmWithATextBox= Nothing

Private Declare Function SetParent Lib "user32" Alias "SetParent" (ByVal
hWndChild As Int32, ByVal hWndNewParent As Int32) As Int32



And in the obtnDef_OnExecute

frmNewForm = New frmWithATextBox(m_inventorApplication)

SetParent(frmNewForm .Handle.ToInt32(), m_inventorApplication.MainFrameHWND)


Anyone see what I might be doing wrong to cause the spacebar to execute the
obtnDef_OnExecute sub?

--

Kent Keller
5 REPLIES 5
Message 2 of 6
Anonymous
in reply to: Anonymous

This problem can be easily solved by starting InteractionEvents whenever your command is activated (even though you do not intend to use them specifically). You can do this like this:

InteractionEvents _interactEvents = _pApplication.CommandManager.CreateInteractionEvents();
_interactEvents.Start();

Please keep in mind that if you have not document opened, the above code will fail.

Hope this helps,

Roxana
Message 3 of 6
Anonymous
in reply to: Anonymous

This problem can be easily solved by starting InteractionEvents whenever your command is activated (even though you do not intend to use them specifically). You can do this like this:

InteractionEvents _interactEvents = _pApplication.CommandManager.CreateInteractionEvents();
_interactEvents.Start();

Please keep in mind that if you have not document opened, the above code will fail.

Hope this helps,

Roxana
Message 4 of 6
Anonymous
in reply to: Anonymous

Hi Kent,

I'm not sure that the SetParent API behaves as expected with .Net dialogs.
Attached are some instructions for a .Net specific method of creating and
parenting a dialog. I think this should solve the problem.
--
Brian Ekins
Autodesk Inventor API
http://blogs.autodesk.com/modthemachine
Message 5 of 6
Rene-J
in reply to: Anonymous


Hi Kent



In .Net

When I call a form I do it this way



Private Sub Button_OnExecute



Dim m_MyForm As MyForm = New MyForm()SetParent(m_MyForm.Handle.ToInt32(), InventorApplication.MainFrameHWND)



MyForm.InventorApplication = InventorApplication



m_MyForm.ShowInTaskbar = False



m_MyForm.ShowDialog()

End sub



In my form





Public Class MyForm





Private Shared oApp As Inventor.Application



Private Declare Function SetParent Lib "user32" Alias "SetParent" (ByVal hWndChild As Int32, ByVal hWndNewParent As Int32) As Int32





#Region "Properties"



Public Shared Property InventorApplication() As Inventor.Application



Get



InventorApplication = oApp



End Get



Set(ByVal Value As Inventor.Application)



oApp = Value



End Set



End Property



#End Region



René J

Message 6 of 6
Anonymous
in reply to: Anonymous

Brian

I have been using this and it seems to work well, except that quite often
when I close my addin, instead of Inventor being the topmost window, some
other program jumps to the top. Any idea what might be causing it or what I
might be doing wrong?

Thanks.

--

Kent Keller
"Brian Ekins (Autodesk)" wrote in message
news:6078705@discussion.autodesk.com...
Hi Kent,

I'm not sure that the SetParent API behaves as expected with .Net dialogs.
Attached are some instructions for a .Net specific method of creating and
parenting a dialog. I think this should solve the problem.
--
Brian Ekins
Autodesk Inventor API
http://blogs.autodesk.com/modthemachine

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report