why keyboardevents NOT working?

why keyboardevents NOT working?

liminma8458
Collaborator Collaborator
653 Views
2 Replies
Message 1 of 3

why keyboardevents NOT working?

liminma8458
Collaborator
Collaborator

Hi,

In an InteractionEvents,  I try to use a keyboardevents at same time with a selectionevents. So while in doSelectEvents_OnPreSelect process, the user can click keyboard (such as space bar, or esc key) to invoke some action. But the code does not work out. Both oKeyPress_OnKeyDown() and oKeyPress_OnKeyPress() have no response. Can somebody try it out and see why?

The code in class is as attached. The code in module is :

Public Sub keyboard_enter_test()
Dim oEdge As Edge
Dim oSelect As New Clsselect_edge_keyboard
Set oEdge = oSelect.Pick(kPartEdgeCircularFilter, "Select a circular edge:")
End Sub

Thanks
Limin
Inventor pro 2023 64 bit update 5.3; Windows 11 pro 64 bit version 24H2; Office 2013 64 bit

Download iCable in App Store to Create Cables Easily

0 Likes
Accepted solutions (1)
654 Views
2 Replies
Replies (2)
Message 2 of 3

laszlo_nagy
Contributor
Contributor
Accepted solution

Hi!

 

When you run the process from VBA Editor, I don't know why but the KeyboardEvents are not active Until you click or Pan the model window

 

try to add this line into you class it works for me 

*Ps sorry for my english

 

----------Class --------------

 

' Set the filter using the value passed in.
oSelectEvents.AddSelectionFilter filter

' Start the InteractionEvents object.
oInteractEvents.Start

'----------------------------------
'ADD THIS LINE 
AppActivate ThisApplication.Caption
'-----------------------------------

' Loop until a selection is made.
Do While bStillSelecting
DoEvents
Loop

Message 3 of 3

liminma8458
Collaborator
Collaborator

Work perfectly.

Thank you so much!!!

Thanks
Limin
Inventor pro 2023 64 bit update 5.3; Windows 11 pro 64 bit version 24H2; Office 2013 64 bit

Download iCable in App Store to Create Cables Easily

0 Likes