LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

How to display context help when the mouse fly over menu items

Is there a way to get event from the menu bar ? I want to display some text in a status bar while the mouse fly over the menu items. However I do not find a way to create a hook function or any attribute that could help to call a custom pre display function (the same applay to custom post display function)

Best regards, Philippe
Visit http://www.baucour.com
0 Kudos
Message 1 of 4
(3,013 Views)
You can use EnableExtendedMouseEvents from the Programmer's Toolbox. You specify a panel and a control (any control will do), then that control's callback will get events anytime the mouse moves over the panel anywhere. You can use eventData1 and eventData2 (which hold the cursor position), to determine if the cursor is over a menu item and then set the text of the status bar text box.

Best Regards,

Chris Matthews
National Instruments
0 Kudos
Message 2 of 4
(3,013 Views)
Chris,

this is fine and I started working that way but I can't figure out how to manage the cases where after clicking, let's say, on the "File" option then the end user fly over "Open" or "Close" item.

Just to make sure, launch Wordpad, click on File, fly over the items below... This is exactly what I'm looking for.

Ok, may be, before displaying the menu I could parse it, make a linked list containing all the length of all the items available (think of cases where there are menus, sub menu, sub sub menu...) and store all the associated coordinates and then every 1/n second get the current mouse coordinate, and find in my linked list which items correspond the rectangle containing the current mouse coordinates and finally send a help string into a st
atus bar.

Well, I guess it is a very good subject for an additional set of functions in the Toolbox and I was looking for an easy way to send comment on the menus items in my status bar.

Please let me know if I missed one point.

Best regards, Philippe

Visit http://www.baucour.com
0 Kudos
Message 3 of 4
(3,013 Views)
Yes, this would be a little challenging to implement since we don't have callbacks or mouse move events for menu items. The basic answer is CVI is not equipped with this feature which is a standard mechanism in Visual Studio document interface UIs. In the usual case though, of a menubar with one level of submenus, it wouldn't be too bad to implement. What you would do is track the mouse when it moves over the menu, then when any menu item is selected and a popup is up, adapt your mouse tracking to include the new submenu screen area. The size of the submenus (width and height of each item) should be constant through out the program.

If you have submenu items that have submenus, it would probably start getting to nasty to implement cle
anly since it would be much more difficult to implement the logic to tell which submenus are currently displayed. If that was the case, it would be much easier to implement Visual C++ menus and host your CVI windows as child windows in a CFormView or CView class.

Chris
Message 4 of 4
(3,013 Views)