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:
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: