LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Anybody know how to create a windows like right click menu in labview?

Anybody know how to create a windows like right (mouse) click menu in labview?
0 Kudos
Message 1 of 4
(4,669 Views)
Yes, check out the following thread:

http://exchange.ni.com/servlet/ProcessRequest?RHIVEID=101&RPAGEID=135&HOID=506500000008000000B1AD0000&UCATEGORY_0=_49_%24_6_&UCATEGORY_S=0&USEARCHCONTEXT_QUESTION_0=contextual+menus&USEARCHCONTEXT_QUESTION_S=0

There is an example as well. I could not find it again here, so I attached a copy. You just need to add code to place the menu where you want it (e.g. by using events to get the right-click event and it's position, feed the x and y coordinates into the show menu VI...).
0 Kudos
Message 2 of 4
(4,669 Views)
Click here for another reference with a little more explanation on the Windows functions called and a LabView 6 version of the same example crediting the author Nadav Chernin.
One note on the example posted here and by Mads: the call to FindWindowA function in Show Pop-Up Menu.vi expects an exact match of the VI name and the name in the window title bar. If the LabView options are set to Show revision number in title bar, FindWindowA will not find a match and the popup will not be displayed. FindWindo
wA will return an hWnd of 0 (invalid) which should generate an Error Out ( but doesn't in this version). Show revision in title bar is controlled through the menu under Tools >> Options >> Revision History (in pulldown listbox).
To detect the right-click, create an event structure, add a Mouse Down event for the control you want to be able to right-click. You detemine right or left click by checking the Button output (left-hand side) in the event case. Depending on how big you made your event structure, Button may not be displayed initially, but you can right-click on Type and goto Select Item >> Button. Button 1 is left-click, button 2 is right-click.
0 Kudos
Message 3 of 4
(4,669 Views)
use event structure mouseclick button=2 ,corresponds to right click
Message 4 of 4
(4,669 Views)