From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Event Structure _ Hover over a contol

Solved!
Go to solution

Hi,

Can LabVIEW detect "hover over a control"? How to implement this using event structure?

I tried using Mouse Move, but this doesn't work as anywhere I move the mouse it is detected as a event. 

I want the event to run when the mouse cursor is exactly on the control.

Thank you!

0 Kudos
Message 1 of 12
(2,950 Views)

Try a mouse enter Event.

 

mcduff

0 Kudos
Message 2 of 12
(2,929 Views)

Yup!

 

You can use the Mouse > Enter event for a specific control:

Example_VI_BD.png


GCentral
0 Kudos
Message 3 of 12
(2,927 Views)

This can be done using the Mouse Enter and Mouse Leave events for the control.

 

Edit: Beaten by everybody!




Certified LabVIEW Architect
Unless otherwise stated, all code snippets and examples provided
by me are "as is", and are free to use and modify without attribution.
0 Kudos
Message 4 of 12
(2,925 Views)

What are the odds? Question posted at 17 minutes past the hour, then 3 responses within a minute of each other, 25 minutes later...


GCentral
Message 5 of 12
(2,915 Views)

Thank you for your suggestion.

I have Event structure and a case structure inside the while loop. 

Once the mouse enter is detected, I want the associated case structure in loop to run until mouse leave event is detected.

Once the mouse leave is detected the loop should stop.

I am not able to get this working as event structure is waiting for an event to occur in the second run of while loop even though thr mouse is still on the control.

 

0 Kudos
Message 6 of 12
(2,897 Views)

Perhaps you could do something like the following:

Example_VI_BD.png

 

This is a fairly scrappy example with two separate stop controls, but you can imagine using a Case Structure in the bottom loop instead of a simple select.

 

Other mechanisms for communicating between loops (here, effectively via Local Variable) include perhaps a Notifier, or User Event, or so on. A notifier would probably fit your purpose fairly well, but if you have more types of things to monitor than just T/F, you could consider Events (of course, you can use more than a boolean with a notifier, so it's still possible, but if complicated, maybe choose a better fitting tool).


GCentral
0 Kudos
Message 7 of 12
(2,849 Views)

@vidyaravanaiah wrote:

Thank you for your suggestion.

I have Event structure and a case structure inside the while loop. 

Once the mouse enter is detected, I want the associated case structure in loop to run until mouse leave event is detected.

Once the mouse leave is detected the loop should stop.

I am not able to get this working as event structure is waiting for an event to occur in the second run of while loop even though thr mouse is still on the control.

 


OK, you have that code! and it does not do what you want it to do.

 

why don't you SHARE your flawed code? we would be much more able to fix it if we could see it.


"Should be" isn't "Is" -Jay
0 Kudos
Message 8 of 12
(2,841 Views)

Here is how I would tackle this using a state machine.  To be able to run it, you will need JKI State Machine installed (can be found on VIPM).  As long as the mouse is in the control, this state will run once and then go to event queue to see if mouse has left control.  If not, execution comes back to this state.  Change the timeout value to control how fast the program runs. 

2019-10-03_10-30-27.png

aputman
------------------
Heads up! NI has moved LabVIEW to a mandatory SaaS subscription policy, along with a big price increase. Make your voice heard.
0 Kudos
Message 9 of 12
(2,801 Views)

Below I am using a JKI State Machine, a UI LAVA tool (tells me if the mouse is within a button), and the "Mouse Move" Event to highlight booleans in a radio control that is used as a hamburger menu. When the cursor is on a button, the boolean is highlighted.

 

mcduff

 

Snap28.pngSnap29.png

Message 10 of 12
(2,789 Views)