Handling Menu Selections
- Updated2025-01-22
- 1 minute(s) read
Handling Menu Selections
After you customize a menu statically or programmatically you must create a Case structure that executes each menu item in the custom menu.
Complete the following steps to handle menu items you created in a custom menu.
- Add a While Loop to the block diagram and drag out a region on the block diagram.
- Add the Current VI's Menubar function outside the While Loop.
- Add the Get Menu Selection function inside the While Loop.
- Wire the Current VI's Menubar function to the menu reference input of the Get Menu Selection function.
- Right-click the ms timeout input of the Get Menu Selection function and select Create»Constant from the shortcut menu. A numeric constant with a value of 200 appears.
- Add a Case structure inside the While Loop and drag out a region inside the While Loop.
- Wire the item tag output of the Get Menu Selection function to the selector terminal on the border of the Case structure.
- Wire the menu reference out output of the Get Menu Selection function to the border of the Case structure.
- Create a case for each menu item you created in the custom menu.
- Run the VI to view the custom menu.
Refer to the labview\examples\Dialog and User Interface\Menu\Customizing the Menubar\Customizing the Menubar.lvproj for examples of handling menu selections.