LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Illegal menu when transferring menu ref. between loops

Hi,

 

I am getting "Error 1160 - Illegal Menu" when I transfer the menu reference from the producer loop to the consumer and try to enable an item in the menu in the consumer loop.

 

Code is attached.

 

Any help on the issue would be appreciated.

 

Thanks!

0 Kudos
Message 1 of 7
(3,124 Views)

I tried running your program and just about never saw that error. (It seemed like it occurred 1 time, but I have no idea why that right click was any different from all the others that did work.)

 

Okay,  I tried running a bunch more times and saw the error more frequently, but still now all the time.  I put indicators on the variant wires in both loops and saw them increment on each menu activation.  No idea why the error sometimes occurs.

0 Kudos
Message 2 of 7
(3,111 Views)

The menu Reference is only valid while in the event case. If you want to preserve the reference so you can over-ride the selection in the consumer loop add a "Enable Menu Tracking" node inside the event case.

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 3 of 7
(3,097 Views)

This is one of the problems with the "producer-consumer" design.  I suggest you not use it.

0 Kudos
Message 4 of 7
(3,083 Views)

Hi Ben,

The menu Reference is only valid while in the event case.

 

If that is the case then why does it throw error in some case but works in other cases.

 

I tried using "Enable Menu Tracking" but the result is still the same. I still get error 1160.

0 Kudos
Message 5 of 7
(3,066 Views)

I think it becomes invalid soon after the event case finishes, when the menu opens, but this is not instant, so you sometimes manage to act on it before it dies.  

0 Kudos
Message 6 of 7
(3,059 Views)

Enable Menu tracking worked when I tried with your first example.

 

The menu reference goes bad when the event case completes. If you want to act on the menu, you should do so in the event itself.

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 7 of 7
(3,028 Views)