Company Events Academic NI Developer Zone Support Solutions Products & Services Contact NI MyNI

Customizing Menus Programmatically

LabVIEW 8.5 Help
August 2007

NI Part Number:
371361D-01

»View Product Info

Complete the following steps to customize a menu programmatically.

  1. Select Edit»Run-Time Menu to display the Menu Editor dialog box.
  2. 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.
  3. Select File»Save and name the custom menu. You can save the menu file wherever you choose.
  4. Close the Menu Editor dialog box.
  5. Place the Current VI's Menubar function on the block diagram.
  6. Place the Insert Menu Items function on the block diagram.
  7. Wire the Current VI's Menubar function to the menu reference input of the Insert Menu Items function.
  8. Right-click the item names input of the Insert Menu Items function and select Create»Constant from the shortcut menu. An array constant appears.
  9. Type File in the 0 slot and Edit in the 1 slot of the array.
  10. Right-click the item tags input of the Insert Menu Items function and select Create»Constant from the shortcut menu. An array constant appears.
  11. 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.
  12. Place a While Loop on the block diagram so the While Loop encloses the menu functions.
  13. Place the Wait (ms) function inside the While Loop to delay execution.
Note  You must wire a value to the milliseconds to wait input of the Wait (ms) function for the VI to run.
  1. 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.

Complete the following steps to add submenu items to existing File and Edit menus.

  1. Place another Insert Menu Items function on the block diagram to the right of the first Insert Menu Items function.
  2. 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.
  3. Wire all error in and error out terminals on the block diagram.
  4. 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.
  5. Type File in the string to add items in the File menu you created in step 9.
  6. 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.
  7. Type Menu1 in the 0 slot and Menu2 in the 1 slot. Repeat this step for the item tags input.
  8. 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.
  9. Use a Case Structure to execute the menu items.
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\general\menubars.llb for examples of customizing menus programmatically.


Resources


 

Your Feedback! poor Poor  |  Excellent excellent   Yes No
 Document Quality? 
 Answered Your Question? 
Add Comments 1 2 3 4 5 submit