Since Inventor 2010, the spacebar has the functionality of repeating the last command. We have an add-in that requires typing a short phrase. (You can see where this is headed)
Whenever you use the spacebar to seperate the words in the phrase, a new addin form opens in front of the old one.
This add-in is employing the WordWrapper code that Brian submitted some time ago to clear up a similiar issue when you used the Enter key, but the spacebar problem persists
Is there a way to disable this funtion? Or work around it?
Did you find out solution for this problem?
I am having similar problem with my addin in Inventor 2012.
Please suggest if you found a way to disable repeat last command option.
I'm not sure, but have you tried to disable userinteraction in Inventor while your form is open? If userinteraction is diabled, Inventor shouldn't react on anything the user do (mouseclick, shortcuts and hopefully spacebar).
abled = True
Be sure to enable Interaction on every possible way your user close the form or your Inventor looks like a screenshot.
Thank you for your suggestion. I did try disabling the user intervention but the problem is if I diable user intervenation user is not able to type in the text for renaming the tree node. My requirement is allow user to enter node name with spaces and disable the last repeat command dialog to open. I thought there should be an option to remove these short cut keys but I could not find any in "Tools -- Cutomize" I could not find one.
The repeat last command internal command name is "AppRepeatCmd" I also tried getting the control defination (ControlDefinition) for this command and set the disable flag to true and I can see that in the contextual menu repeat last command is disabled but when I hit space/enter key it still opens the command dialog, so no luck.
Any other suggestions on hot to supress the event which triggers last executed command?
Are you using a modeless dialog? That's where the user is trying to enter a text that includes a space?
What about using a modal dialog instead?
Also, you could try setting Inventor as the parent of your modeless window:
#Region "hWnd Wrapper Class"
' This class is used to wrap a Win32 hWnd as a .Net IWind32Window class.
' This is primarily used for parenting a dialog to the Inventor window.
' For example:
' myForm.Show(New WindowWrapper(m_inventorApplication.MainFrameHWND)
Public Class WindowWrapper
Public Sub New(ByVal handle As IntPtr)
_hwnd = handle
Public ReadOnly Property Handle() As IntPtr _
Private _hwnd As IntPtr
I hope this helps.
If my post answers your question, please click the "Accept as Solution"
button. This helps everyone find answers more quickly!
Thank you for reply. Actually I am not using any dialog, This is rename command where user right mouse click on tree node and click on rename and enter the name for node. While entering the name for node if user hit space last command dialog appears.
I was able to avoid the problem temporarily by InteractionEventsObject:tart() before starting rename command and InteractionEventsObject:top() once rename operation is complete. This is not an ideal solution because when I do this after entering the name if user hit the 'Enter' key it does not complete the rename operation.
I mean user has to click on some where in graphics screen to complete the rename operation.
Which Inventor version are you using? OS version?
Could you please provide the exact steps to reproduce the problem?
I checked in Inventor 2011 and when I selected a part occurrence in the browser tree and then clicked on it again to change the name, the space bar did not start the last command. If I clicked in the drawing area and then pressed space bar then the last command got repeated.