LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Error 1160 - Illegal Menu: Revisited

Solved!
Go to solution

Hi Folks -

 

Simple example VI here.  LabVIEW 2011.  Getting Error 1160 when I select an item (try 'Apply Digital Filtering' item for this example) from the right-click shortcut menu on the waveform graph.  Not sure why.

 

Is this another case where I need to build the menu at run-time (even though this is in the source code and not the .exe)?

 

see Here

 

 

Any help is appreciated.

 

Thanks,

 

Don

0 Kudos
Message 1 of 5
(4,397 Views)
Solution
Accepted by topic author DonRoth

DonRoth,
The method you are using of saving the MenuRef from the "Graph": Shortcut Menu Activation? event will not work as you are expecting. This is because after the user clicks an item, and the shortcut menu closes, the MenuRef item is destroyed. Any future references to this will result in a Error 1160 LabVIEW: Illegal menu. error.

 

For this reason, the MenuRef reference is not available in the "Graph": Shortcut Menu Selection (User) event, which is the event you are attempting to use this reference in.

 

I looked at your code, and I see you are attempting to toggle the "Checked" status of shorcut menu items that the user clicks on. Because this is not a straightforward operation, I have create a Community example that shows how to do this.

 

You can find the Community page here:
Setting Checkmarks Programmatically on Shortcut Menus - https://decibel.ni.com/content/docs/DOC-22360

This example shows how to achieve setting the checked status by keeping track of the status of each item in our menu, and toggling the checked state of the item the user selects.

Jared A.
Applications Engineer
National Instruments
Message 2 of 5
(4,367 Views)
I will look at your example and I appreciate your help. This is extremely interesting to me that the menu ref gets destroyed as soon as the menu disappears.

Actually what I need to do is disable the other two options under the Filtering parent once one of the filtering options is checked. Then when it is unchecked, the other two items become enabled once again.

Is your example applicable for an executable? This is quite critical.

Thanks,

Don
0 Kudos
Message 3 of 5
(4,359 Views)

Don,
I'm glad that the Community example (linked above) was able to help you.

 

As you have already probably noticed, the example can easily be extended to enable/disable menu items. Thank you for your comments on the Community page. After you finish your implementation, I would encourage you to create a posting in the Community so other users can have an example of how to enable/disable menu items.

 

I have built my Community example into an executable and can confirm that this will also work in an executable.

Jared A.
Applications Engineer
National Instruments
0 Kudos
Message 4 of 5
(4,344 Views)

Hi Jared -

 

I did not see a way to add an attachment at the community page you posted at here so I am going to add it to this discussion.

 

This example builds on the posted community example.  In my case, I want to disable the other items under the same parent menu after one item gets checked, or re-enable those same items after the one item gets unchecked.

 

I am attaching a VI of my strategy for the latter with this comment.

 

I tested this in an executable and it and it works fine, so possibly the waveform graph never had issues with this menu showing up in the executable to begin with.  (The example I pointed to here dealt with a table control having problems showing right-click shortcut menus in executables.)

 

Don

 

Thanks,

 

Don

0 Kudos
Message 5 of 5
(4,332 Views)