Handling Menu Selections

After you customize a menu statically or programmatically you must create a Case structure that executes each menu item in your custom menu.

Complete the following steps to handle menu items you created in your custom menu.

  1. Select a While Loop on the Functions»Structures palette and drag out a region on your block diagram.
  2. Select the Current VI's menu bar function on the Functions»Application Control»Menu palette and place it outside the While Loop.
  3. Select the Get Menu Selection function on the Functions»Application Control»Menu palette and place it inside the While Loop.
  4. Wire the Current VI's menu bar function to the menubar 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 appears.
  6. Type 200 in the numeric constant.
  7. Select a Case structure on the Functions»Structures palette and drag out a region inside the While Loop.
  8. Wire the menubar out output of the Get Menu Selection function to the question mark on the border of the Case structure.
  9. Wire the item tag output of the Get Menu Selection function to the border of the Case structure.
  10. Create a case for each menu item you created in the custom menu.