LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

monitoring events from an Event Structure

I'd like to monitor most of the events from an Event Structure. The way I'm doing it now is clunky; I have a subVI in all of the events that uses the "CtrlRef" and "Type" inside each Event Structure case and creates a string that I append to a list on my front panel. For example, the list might say:

Slider, Value Changed
Numeric, Value Changed

Having a subVI in each case seems very awkward; is there a better way to monitor events from an Event Structure?
0 Kudos
Message 1 of 6
(3,356 Views)
You may want to check out the producer/consumer with events structure in the examples.

What are you using the String for??  (Slider, Value Changed)  What is the list for??  Just an indicator of what has been pressed??

I guess we would need some more information on what you are exactly trying to accomplish.

Kenny
Kenny

0 Kudos
Message 2 of 6
(3,348 Views)

Well, if the same subVI is in all event cases, the subVI belongs outside the event structure. Now feed all the control references and type outputs from all the cases to a single output tunnel on the right boundary of the event structure, then to your subVI. 🙂

If some events don't have a control reference, place the subVI in a case structure and place a TRUE boolean in some of the event cases to decide if the subVI needs to execute. If the output tunnel is set to "use default if unwired", you only need a few TRUEs, while most cases don't need a boolean at all.

Message Edited by altenbach on 01-02-2007 08:54 AM

Message 3 of 6
(3,345 Views)
Ooh, perfect reply <b>altenbach</b>.

I've attached a little demo in which I have no subVI (just to make it all one VI), and instead of using the Boolean you suggested, I allow the control reference to be invalid.
0 Kudos
Message 4 of 6
(3,328 Views)
Two small things: 🙂
  1. I typically prefer a shift register to keep the event string. This eliminates all the local variables (see image).
  2. "# of timeouts" should probably be called "# of iterations". All events will cause an increment.

Message Edited by altenbach on 01-02-2007 04:42 PM

0 Kudos
Message 5 of 6
(3,304 Views)
On item #1, when appending to a listlike string, I've always found a reference to said string to be most efficient; pass said reference to a subVI that appends then scrolls to the bottom, rather than my "append on top" concept. Your shift register idea is more true to form for the dataflow concept; that I like. Also, I would never actually use the local variable thing like I did in real life! That was just for simplicity of the demo.

On item #2, you're right. It should be "iterations", not "timeouts".

Thanks again for the initial hint, that got me out of my mental rut.
0 Kudos
Message 6 of 6
(3,291 Views)