LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Generate user event for a run-time menu handled by an event structure

Hello everyone!

Excuse my pertinacity.
Due to 0 replays since friday and urgency I'm retrying.

I've implemented a run-time menu with several items into my VI. The menu selection is controlled by an event structure inside of a while loop. It works faultless. Now I need to start the execution of a subdiagramm inside the "Menu Selection (User)" event case (e.g. ItemTag = "ReloadDefFile") without selecting a menu item. It should work similar to "Value(Signaling)" property node for controls or indicators handled by an event structure. The only property I found for run-time menu is the "RTMenuPath" in the VI Server->VI class. All my attempts with "create -" and "generate user event" failed.

Is there a possibility to solve my problem? Does somebody have similar experience/code?

Best regards,
Udo
0 Kudos
Message 1 of 5
(3,426 Views)
Hi Udo

First of all - do you work with some kind of producer - consumer?

If not, this was a solution to your problem - because you can produce something (usually enqueue a value) and consume it in another loop. This allows you, to call the same code from various source. For example you could enqueue the element exec-subdiagramm in your menu event case but also in an event case where you react on a boolean control.

In addition - try to avoid placing big functions in a event-structure, because it is blocked until the event execution your function has finished.

Thomas
Using LV8.0
--------------------------------------------------------------------
Don't be afraid to rate a good answer... 😉
--------------------------------------------------------------------
0 Kudos
Message 2 of 5
(3,423 Views)
Udo,

I recently ran into something similar, but from the other direction: I started with some buttons that were handled in an event structure, and I wanted to add a set of matching, redundant commands in the run-time menu that would trigger the same event cases as the buttons.

This seems like a common situation, and I couldn't help but wonder if I was missing something too.

In the end, my solution was a two-stage approach where each button and menu event performed a "Value(Signaling)" property node update on a single string control. Then I created an event case for that string control and used the updated value to determine what code to actually run.

This obviously required some cutting-and-pasting from the original set of event cases, but it seems to work well. Attached is a simple example (LV 7.1.1).

Regards,
John

Message Edited by Johnner on 04-06-2005 09:21 AM

Message 3 of 5
(3,415 Views)
Thanks Thomas, thanks John.

Johns way to handle this problem is very very ingenious. I've always tried it the other way around and never thought on the
possibility to "simply" control a button via a run-time user menu, so that the button is accessible from both, menu and
front panel. I will implement my "actions" inside the button event case. It is a simple cut and paste.

Thank you once again.

Best regards,
Udo
0 Kudos
Message 4 of 5
(3,401 Views)

John,

  Thank you for your example code! I found it helpfull to solve my little problem and was able to move complex code out of the event structure as a result.

Regards,

Joshua.Robot

0 Kudos
Message 5 of 5
(3,064 Views)