11-28-2025 06:45 AM
Hello, there.
I hope someone may help me out.
I am trying to implement a GUI that:
- when the user clicks on a button, a vi pops up for user interaction. it must be closed by the user (this is easy 😉)
- when the user hovers on the button, the vi pops up, for a quick preview
- when the mouse leaves the button, the popup goes away
- if, while the popup is visible, the user moves to it and clicks on the popup itself, then it stays on as if the user had clicked on the button
I know I might do this with Tab Control and sub-panels, but I though to 'pep-up' the GUI a little bit.
Trouble is, it's not working 😭, so I am doing something wrong, or not doing something, or missing some knowledge to attack this problem or - most probable - all of the above.
In the example, the front panels are empty, this is just for the sake of trying the functionality I'd like. They will be filled with an instrument control panel.
One thing I observe is that when hovering, the popup comes on and off, which probably is due the the fact that the main looses focus and a "mouse leave" event is issued, even if the mouse has not moved.
The popup pops-up partially over the button because I placed it there. Ideally, I'll have to place it programmatically right besides the cursor position, otherwise I must certainly hover off the button in order to reach it and click on its front panel - and it will disappear in the meantime (because of mouse leave event).
Please, somebody HELP!!! (where/when did I hear this before? 😎)
Solved! Go to Solution.
11-28-2025 07:14 AM
There are Mouse Enter and Mouse Leave-events, use those onthe buttons and the sub-vi Panel and it should be possible.
11-28-2025 07:46 AM
@Gyc a écrit :
One thing I observe is that when hovering, the popup comes on and off, which probably is due the the fact that the main looses focus and a "mouse leave" event is issued, even if the mouse has not moved.
The popup pops-up partially over the button because I placed it there. Ideally, I'll have to place it programmatically right besides the cursor position
Because the pop-up is above the button :
1. "Mouse Enter" event : display the pop-up
2. The mouse is now on the pop-up : it has leaved the button
3. "Mouse Leave" event : hide the pop-up
4. The mouse is now on the button again : back to step 1.
Change the position of the pop-up before displaying it and it should be good.
@Gyc a écrit :
I must certainly hover off the button in order to reach it and click on its front panel - and it will disappear in the meantime (because of mouse leave event).
In the "Mouse Leave" event, you should check the mouse position before hiding the pop-up.
If mouse is leaving the button but still hover the pop-up : don't hide it.
11-28-2025 08:24 AM - edited 11-28-2025 08:26 AM
@PinguX wrote:
@Gyc a écrit :
One thing I observe is that when hovering, the popup comes on and off, which probably is due the the fact that the main looses focus and a "mouse leave" event is issued, even if the mouse has not moved.
The popup pops-up partially over the button because I placed it there. Ideally, I'll have to place it programmatically right besides the cursor position
Because the pop-up is above the button :
1. "Mouse Enter" event : display the pop-up
2. The mouse is now on the pop-up : it has leaved the button
3. "Mouse Leave" event : hide the pop-up
4. The mouse is now on the button again : back to step 1.
Change the position of the pop-up before displaying it and it should be good.
This what I suspected.
But I must have a "mouse leave" event....
And if the popup is far from the button, when I move to it the 'mouse leave' event is due and will hide the popup.
@PinguX wrote:
@Gyc a écrit :
I must certainly hover off the button in order to reach it and click on its front panel - and it will disappear in the meantime (because of mouse leave event).
In the "Mouse Leave" event, you should check the mouse position before hiding the pop-up.
If mouse is leaving the button but still hover the pop-up : don't hide it.
Good suggestion, let me try that.
Basically, in case mouse leave is issued, if the cursor is still placed "on" the button, the event is due to popup appearing and should do nothing.
And so, the shift register flag "PopUpRunning" is useless...
11-28-2025 09:02 AM
Good progress, thanks PinguX.
However, something is not smooth yet.
If I hover off the button (up, left or down) the popup goes away if I move quickly.
If I move the mouse slowly, it stays on. Of course it suffices to go back to the button and hover off again quickly - but it's a bit inelegant.
Also:
-when I slide the cursor from the button to the popup, sometimes it flickers, sometimes it stays on, sometimes it goes away.
-if the cursor is on the left edge of the button, when I start sliding it right to the popup, the popup disappears.
-if the popup pops-up right under the mouse pointer, everything works fine
11-28-2025 09:30 AM
You tried to complicate things unnecessarily.
11-28-2025 10:19 AM - edited 11-28-2025 10:46 AM
@PinguX wrote:
You tried to complicate things unnecessarily.
I see your point (hey, I managed to... 😉😁😎).
Nice catch, it works!
I admit, I would never think of testing for the area where the popup hovers on!
Thanks!!!!!