Jump to content

Hovering over a drop down menu is causing "Mouse Leave" event to trigger


Recommended Posts

Hi, I also posted this on the NI forums, as I can't find a solution... if anyone can help I'd be very grateful!

I have a tab control set to change to a different page when the user's mouse enters or exits the tab control. The purpose of this is so that the tab control becomes invisible when coloured "transparent", depending on the user's mouse movement. This allows the full screen to be used for viewing the video when menus aren't needed, and menus can appear when the user moves into the tab area. There is also a button to lock the menu in place.

This worked really well until I added some Text Rings to a sub tab menu. When the user clicks the drop down arrow, and hovers over the items, the event case registers as if the mouse has left the tab control, and the tab resets back to page 1 (blank page). I don't want this to happen, but I still want to use drop down menus as they are more concise and convenient than the alternatives (listboxes etc). This does not happen with buttons, and other controls, only with drop down menus as far as I know.

Can anyone suggest a workaround? I have chosen this trigger method because it is less processor intensive than using the mouse move event coordinates to trigger the tabs to appear. I need to save as much processor time for video capture as possible. I have attached the vi below for you to see for yourself.

Microscope test.vi

Link to comment

I thought you might be able to track the combo box's enter/leave events and use that to dictate logic in the tab control leave event, but the combo dropdown itself doesn't re-establish the bounds of the control and when you mouse to select something in the list, LabVIEW still registers the combo leave event.

You could instead track mouse down events on the combo box, but that becomes messy when you need to figure out if the user clicked off the combo box somewhere (anywhere) else.

Link to comment

Hi asbo,

I got a reply on the NI forums and it looks promising - there is an event named "operate menu activation" which applies to the text rings, and if I feed out a boolean constant that cancels the mouse leave event while the menus are being used, the problem shouldn't occur. I'll post back if it works.

Link to comment

My reply on the "dark side" accidentally pointed you towards a "super secret" private event that seems to do the job with minimal hacking. To learn more about them I suggest you read the pinned post in the Lava Scripting page, and then read about the required ini key here:


Some properties and events are private for very good reasons, others for more mysterious reasons. I would use them with caution, but I have not had problems with this particular one.

Disclaimer: If your computer catches fire, you didn't hear about this from me.

Link to comment

Ah ha! I had a quick look for that event, came up empty, and went home confused. Thanks for the clarification.

Most of the time the Context Help says PRIVATE: blah blah blah, but not in this case. I'd be (even further) into hack-town if it weren't for a few of those events.

So, I can make a change to the ini file, and that event will become available in the menu? What's strange is that the mod worked in my version without me doing any hacking.

Yes, kind of funny that way. A lot of built-in stuff uses those methods and events, and with some of this power comes great responsibility. You could try using Dynamic Event Registration, wrap the Reg Events Node inside a locked subVI, and then feed the refnums into the Event Structure. This would give access to the Event on any machine while sequestering the private bit.


Then clean up the names a bit using a bundle function:


  • Like 1
Link to comment

I have added the special lines to the ini file. The mod works while the camera is running, so problem solved! It took me a while to work out what you did above, and now it makes sense, very good! So I can use the event without having the modified ini file. I hope NI adds the event as an official feature, I don't see how it could be harmful.

Edit -

I am trying to make the Sub VI, and don't know how to make a non-strict reference for controls for the sub VI connection diagram. I know error control and indicator clusters are in the palettes... Also, would I have to make this sub VI for each control type - enum, ring, combo box, etc?

Edited by JMak
Link to comment

What I usually do is drop a class specifier constant and choose a class. Then I create a control from it. You do not need a sub VI for all of the possibilities, for example you pass a reference to a NamedNumeric control which will cover rings and enums (do not include data type). Then you will need one for a ComboBox. Hopefully that would cover it.

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...

Important Information

By using this site, you agree to our Terms of Use.