Tue, 07/11/2017 - 17:23
Forums:
Hi,
In my application, when a user selects an AIS_Object in the viewer, I would like to highlight a corresponding node in aTreeView gui control elsewhere in the UI.
How can I receive notification that the user has selected (or deselected) and object in the viewer so that I can take external action (e.g. select a treeview node)?
I searched the forums for terms like 'selection notification', 'selection callback', 'selection event' but didn't find anything.
Thanks,
-Eric.
Wed, 07/12/2017 - 10:34
Hello,
This should be the application-side event. For example, when user clicks on the OCCT context window you should find out which object was selected and then call a callback function or emit signal.
Wed, 07/12/2017 - 16:24
Thanks for the reply, Anton. I'm not sure I fully understand your answer.
Do you mean that in my Windows app, I should add code to the 'OnMouseLButtonUp' event/message handler on the OCCT Window to check OCCT for what the selection state of all the entities are in the scene? This seems like a lot of processing to do every time the user releases the mouse button.
Perhaps I am missing some detail of your suggestion?
Are you aware of any sample code you could refer me to that does selection checking in this manner?
Thanks! -Eric.
Thu, 07/13/2017 - 05:11
Hi,
It is exactly what I mean. For example, when user clicks, you need to take current cursor position and pass it to OCCT context as follows:
Or like this:
And then you can get selected objects:
And now you can call your callback function if there are selected objects
Thu, 07/13/2017 - 15:13
Thank you! I appreciate the quick and clear response.
-Eric.