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.
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.
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.
This is one of the problems with the "producer-consumer" design. I suggest you not use it.
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.
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.
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.