Hello API Support,
When I click the Escape button, All the selection events are stopped working. Please follow the steps below reproduce.
1. Create the Select Events Object using the following steps.
m_pCommandManager->CreateInteractionEvents(&m_spiInteractor);
m_spiInteractor->put_SelectionActive(VARIANT_TRUE);
hr = m_spiInteractor->get_SelectEvents(&m_spiSelectEventsObj);
m_spiSelectEventsObj->put_Enabled(VARIANT_TRUE);
m_spiSelectEventsObj->PutWindowSelectEnabled(VARIANT_TRUE);
m_spiSelectEventsObj->AddSelectionFilter(kPartVertexFilter);
m_spiSelectEventsObj->AddSelectionFilter(kPartFaceFilter);
CComObject<CNESelectionEventHandler>* pSelectEvents;
CComObject<CNESelectionEventHandler>::CreateInstance( &pSelectEvents);
m_pSelectEventsSink = pSelectEvents; m_pSelectEventsSink->AddRef();
hr = m_pSelectEventsSink->DispEventAdvise( m_spiSelectEventsObj );
m_spiInteractor->Start();
2. Open the part and Select any face in the model.
I get the following event. STDMETHODIMP CSelectionEventHandler::onEvent_OnSelect(ObjectsEnumerator * JustSelectedEntities, SelectionDeviceEnum SelectionDevice, Point * ModelPosition, Point2d * ViewPosition, View * View )
3. Now click on the Escape button. Now if you try to select any face , no call back is received.
Let me know if you need more information.
Regards
Sekhar
Solved! Go to Solution.
Solved by ekinsb. Go to Solution.
Hi Sekhar,
I believe it is by design. You can detect this through the UserInputEvents.OnTerminateCommand event. In fact the documentation for this event states "Pressing the escape key will terminate the current command."
Regards,
cadull
Hi cadull,
Thanks for your reply.
Is there any way I can chose to prevent this.
What I am doing is:
1. I create a Dialog.
2. In the dialog, I created a Selection Box for the user to see what he has selected.
3. When user opens up the dialog, I register the select events object.
4. Now, I receive all the selection events. I will add all the selected objects to my Selection Box.
5. Now, if incase user clicks Escape button, the selection events are stopped but my dialog is still open.
6. I would like to unregister select events only when user closes the dialog.
Let me know if you have any solution.
Regards
Sekhar
Selection events are part of the InteractionEvents object. A better name for this object would have been ClientCommand because it's through this object that you get a lot of standard Inventor command behavior. When you start your InteractionEvents object it starts your command. If an Inventor or other add-in command is running, they are terminated and your command takes over where it can receive the mouse and selection events and draw preview graphics. Inventor commands are terminated when the user selects another command or presses the Escape key, which starts the Selection command. The InteractionEvents object supports some events to allow your command to behave correctly. There is an OnTerminate event that indicates your InteractionEvents (command) is being terminated. In this case you should clean up and close your dialog. There are also OnSuspend and OnResume events that are used when the user runs a stackable command, like one of the view commands. In the OnSuspect event you can choose to temporarily hide your UI and then on the OnResume display it in the previous state so the user can continue where they left off.