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