Error 1160 at Set Menu Item Info in LabVIEW

Updated Jun 2, 2021

Reported In

Software

  • LabVIEW

Issue Details

When using the Set Menu Item Info VI to disable/enable a shortcut menu item, I get error code 1160 when running the VI with the following message:

Error 1160 occurred at Set Menu Item Info in Example.vi

Possible reason(s):
LabVIEW: (Hex 0x488) Illegal menu.

 
Error 1160.png

Solution

This type of error can happen when there is an invalid menu reference wired to the Set Menu Item Info VI or when the Shortcut Menu Acitvation? Event is not being used to get the menu reference. In order to enable/disable a shortcut menu item programmatically correctly, please follow these steps:

1. Create an event structure if there is not already one in your block diagram.
2. Add the Shortcut Menu Activation? Event that will get generated when the user right-clicks on a control to display the shortcut menu by right-clicking on the event structure and selecting Add Event Case...
3. Configure the event by selecting the source which should be a control or element in the front panel that has a shortcut menu, it should look similar to the image below:
 
Add shortcut menu activation event.png

4. Go to the Shortcut Menu Activation? Event and wire the MenuRef to the menu reference input of the Set Menu Item Info VI.
5. Wire the item tag to the Set Menu Item Info VI and use the enable terminal to specify the state of the selected shortcut menu item.
6. Add any necessary logic to select which shortcut menu items need to be enabled/disabled.

The resulting VI should look similar to the one below:
Shortcut menu activation.png