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: 

Problem with custom dropdown menu

Solved!
Go to solution

Hello guys,

 

in order to create a less chaotic GUI that still allows a lot of functionalities I wanted to create a simple and customizable drop down menu, that opens when the mouse hovers over a button and closes either by the mouse leaving the menu or clicking a certain button.

 

That all works well as long as I do not use an enum control. That is where the problems start:

 

1. When clicking on the enum control it seems as if a "Mouse Leave" event is triggered, that causes the menu to hide. But I need the mouse leave event to hide the menu once the user moves the mouse away. An alternative would be to implement a close button, but that is way less smooth.

 

Now I have a really bad, quick and dirty workaround which somehow "solves" this problem: There is an additional Enum:"Value changed" event that makes the menu visible again. But that leads to problem 2:

 

2. If the user reselects the already selected value (no value is changed then), then the menu does not appear again.

 

In the attachment you will find an example VI that shows those problems.

 

So actually I am looking for a solution that is not as nasty as mine 😎 Do you have any ideas? That would be great!

 

Thanks a lot in advance.

Jenso

0 Kudos
Message 1 of 4
(2,621 Views)
Solution
Accepted by topic author Jenso

Stuff like this will always result in "hacks". In other words: your rowing against the stream.

 

Here's a "solution".

 

+ Put a big dummy Boolean (transparent) on the entire screen (fit to pane), move to the background, behind everything.

+ Replace the Add and cluster mouse leave events with a dummy Boolean mouse enter event.

+ Optionally, show the dummy Boolean only when the menu is activated. Hide when it's not.

 

That seems to work much better, but you'll probably run into other (unpredictable) problems. One thing is that editing the MMI with the big Boolean on the background is a pain.

Message 2 of 4
(2,605 Views)

wiebe@CARYA wrote:

 

+ Put a big dummy Boolean (transparent) on the entire screen (fit to pane), move to the background, behind everything.

+ Replace the Add and cluster mouse leave events with a dummy Boolean mouse enter event.

+ Optionally, show the dummy Boolean only when the menu is activated. Hide when it's not.


Like this. Not sure if the menu should disappear on string or enum value changes, but seemed preferable to me.

0 Kudos
Message 3 of 4
(2,599 Views)

That is a gorgeously simple solution. I do not need half a thousand property nodes for this one. Although you are correct, editing the background button IS a pain. But I still like that solution.

 

Thanks!!

Jenso

0 Kudos
Message 4 of 4
(2,560 Views)