Complete the following steps to customize a menu programmatically.
Select Edit»Run-Time Menu to display the Menu Editor dialog box.
Select Custom from the pull-down menu of the Menu Editor dialog box.
Click the red X button in the toolbar to delete the question marks from the Hierarchy listbox.
Select File»Save and name your custom menu. You can save the menu file wherever you choose.
Close the Menu Editor dialog box.
Select the Current VI's Menubar function on the Functions»Application Control»Menu palette and place it on the block diagram.
Select the Insert Menu Items function on the Functions»Application Control»Menu palette and place it on the block diagram.
Wire the Current VI's Menubar function to the menubar input of the Insert Menu Items function.
Right-click the item names input of the Insert Menu Items function and select Create»Constant from the shortcut menu. An array constant appears.
Type File in the 0 slot and Edit in the 1 slot of the array.
Right-click the item tags input of the Insert Menu Items function and select Create»Constant from the shortcut menu. An array constant appears.
Again, type File in the 0 slot and Edit in the 1 slot of the array. Menu item tags can have the same name as menu item names.
Place a While Loop on the block diagram and place a Wait function inside the loop to delay execution.
Change focus to the front panel. At this point, if you click the Run Continuously button a File and Edit menu appear on the front panel. However, there are no submenu items.
Complete the following steps to add submenu items to your existing File and Edit menus.
Place another Insert Menu Items function on the block diagram to the right of the first Insert Menu Items function.
Wire the menubar out and error out output of the first Insert Menu Items function into the menubar and error in input of the second Insert Menu Items function.
Right-click the menu tag input of the second Insert Menu Items function and select Create»Constant from the shortcut menu. An array constant appears.
Type File in the array to add items in the File menu you created in step 9.
With the second Insert Menu Items function, right-click the item names input of the Insert Menu Items function and select Create»Constant from the shortcut menu. An array constant appears.
Type Menu1 in the 0 slot and Menu2 in the 1 slot. Repeat this step for the item tags input.
Change focus to the front panel. Click the Run Continuously button. Your front panel includes a File menu and an Edit menu with Menu1 and Menu2 as subitems in the File menu.