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 Menu Type pull-down menu. The question marks in the Hierarchy listbox indicate that you are creating a new item that does not have a name yet.
Select File»Save and name the custom menu. You can save the menu file wherever you choose.
Wire the Current VI's Menubar function to the menu reference 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.
Add a While Loop to the block diagram so the While Loop encloses the menu functions.
Add Find
Add the Wait (ms) function inside the While Loop to delay execution.
Add Find
Note You must wire a value to the milliseconds to wait input of the Wait (ms) function for the VI to run.
Switch to the front panel window and click the Run Continuously button. A File and Edit menu appear in the front panel window. However, there are no submenu items.
Adding Submenu Items to Existing File and Edit Menus
Complete the following steps to add submenu items to existing File and Edit menus.
Add another Insert Menu Items function to the block diagram to the right of the first Insert Menu Items function.
Add Find
Wire the menu reference out and error out output of the first Insert Menu Items function into the menu reference 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. A string constant appears.
Type File in the string to add items in the File menu you created in step 9.
On the second Insert Menu Items function, right-click the item names input 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.
Switch to the front panel and click the Run Continuously button. The front panel window includes a File menu and an Edit menu with Menu1 and Menu2 as subitems in the File menu.
Note You also can add default LabVIEW menu items by providing the application item tags as inputs to the Insert Menu Item function.
Refer to the labview\examples\Dialog and User Interface\Menu\Customizing the Menubar\Customizing the Menubar.lvproj for examples of customizing menus programmatically.