04-26-2012 02:39 PM - edited 04-26-2012 02:45 PM
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
Solved! Go to Solution.
04-27-2012 04:37 PM
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.
04-27-2012 08:33 PM
04-30-2012 11:20 AM
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.
05-01-2012 12:43 PM - edited 05-01-2012 12:44 PM
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