LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Get control at mouse position

Hi

I need to get a reference to the control that is a the mouse position.

How could that be done?

0 Kudos
Message 1 of 7
(3,588 Views)

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


If Tetris has taught me anything, it's errors pile up and accomplishments disappear.
0 Kudos
Message 2 of 7
(3,576 Views)

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.

0 Kudos
Message 3 of 7
(3,557 Views)

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.


If Tetris has taught me anything, it's errors pile up and accomplishments disappear.
0 Kudos
Message 4 of 7
(3,552 Views)

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

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 5 of 7
(3,550 Views)

If you can collect ALL controls' refs once, you can use dynamic events

ctrl.png

Message 6 of 7
(3,543 Views)

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.

 

 

0 Kudos
Message 7 of 7
(3,532 Views)