Company Events Academic Community Support Solutions Products & Services Contact NI MyNI

Customizing Run-Time Shortcut Menus for Controls Programmatically

LabVIEW 2013 Help

Edition Date: June 2013

Part Number: 371361K-01

»View Product Info

Complete the following steps to customize a menu for a control programmatically.

  1. Add a control to the front panel. This example uses a numeric control.
  2. Add an Event structure to the block diagram. It is not necessary to enclose the numeric control in the Event structure.

  3. Right-click the Event structure and select Edit Events Handled by This Case from the shortcut menu.
  4. In the Edit Events dialog box, select Numeric from the Event Sources list and select Shortcut Menu Activation? from the Events list.
  5. Click the OK button to close the dialog box.
  6. Add the Insert Menu Items function to the block diagram inside the Shortcut Menu Activation? Event structure.

  7. Right-click the item names input of the Insert Menu Items function and select Create»Constant from the shortcut menu. An array constant appears.
  8. Type Help in element 0 and Copy in element 1 of the string array constant.
  9. Wire the MenuRef event data field to the menu reference input of the Insert Menu Items function.
Tip  If you do not want the default shortcut menu items to appear, use the Delete Menu Items function. To remove the default shortcut menu items, wire the MenuRef event data field to the menu reference input of the Delete Menu Items function and then wire the menu reference out output to the menu reference input of the Insert Menu Items function.
  1. Click the Run Continuously button.
  2. Switch to the front panel and right-click the numeric control. The shortcut menu includes a Help item and a Copy item.
  3. Configure a Shortcut Menu Selection event to handle the selection of the items.
Note  You also can add default shortcut menu items by providing application item tags as inputs to the Insert Menu Items function.

 

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