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.

  1. Add a While Loop to the block diagram and drag out a region on the block diagram.
  2. Add the Current VI's Menubar function outside the While Loop.
  3. Add the Get Menu Selection function inside the While Loop.
  4. Wire the Current VI's Menubar function to the menu reference input of the Get Menu Selection function.
  5. 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.
  6. Add a Case structure inside the While Loop and drag out a region inside the While Loop.
  7. Wire the item tag output of the Get Menu Selection function to the selector terminal on the border of the Case structure.
  8. Wire the menu reference out output of the Get Menu Selection function to the border of the Case structure.
  9. Create a case for each menu item you created in the custom menu.
  10. 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.