10-03-2019 12:17 AM
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!
Solved! Go to Solution.
10-03-2019 12:41 AM
Try a mouse enter Event.
mcduff
10-03-2019 12:41 AM - edited 10-03-2019 12:41 AM
10-03-2019 12:41 AM - edited 10-03-2019 12:42 AM
This can be done using the Mouse Enter and Mouse Leave events for the control.
Edit: Beaten by everybody!
10-03-2019 12:43 AM
10-03-2019 01:17 AM
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.
10-03-2019 04:01 AM
Perhaps you could do something like the following:
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).
10-03-2019 04:20 AM
@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.
10-03-2019 10:33 AM - edited 10-03-2019 10:39 AM
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.
10-03-2019 10:52 AM
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