07-18-2018 04:56 AM
Hi
I need to get a reference to the control that is a the mouse position.
How could that be done?
07-18-2018 05:28 AM
taking your question at face value,
the only way i know is to create an event structure and for any control you have a mouse over event.
perhaps we can help you better,
if you are a little bit more specific about the "real" problem you try to solve.
regards
07-18-2018 06:33 AM
I would like to take a screenshot (Get Image method) of the control that is currently hovered, using a shortcut (Menu Selection (User) event).
And I have lots of SubPanels containing VIs so anything based on control events would be a hassle to implement in every VI.
The only thing I can think of is to go through all controls of every SubPanel VI and check which one contains the mouse position in its bounds, but that seems huge too.
07-18-2018 06:44 AM
in a quick test, the event structure does not work with subpanels. 😞
that makes the whole thing very much a pain.
it seems you might need explicit buttons for the to-screenshot function
or as you yourself suggested, some kind of lookup table.
07-18-2018 06:46 AM
1. Get mouse position
2. Get the Array of all Controls and extract their position/sizes
3. Compare.
What are you really trying to achieve?
/Y
07-18-2018 07:00 AM
If you can collect ALL controls' refs once, you can use dynamic events
07-18-2018 07:37 AM
As others have mentioned, there is no straightforward way to do this. Why exactly do you want to screenshot just the control?
You could write a little API that includes a daemon event handler for handling the events, and in each of your subpanels, bundle an array of all the control references you want to include, and send them to the event handler using user events, then update the event handler registration to include the new control references.