LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Wait for User Event

Is there any way to wait for a user event and get the data put WITHOUT USING AN EVENT STRUCTURE?  I'm using events because 95% of the time Event structures are easy and the natural thing to do, but sometimes it'd be helpful to just be able to wait for the event without the huge event structure.  Thanks!

0 Kudos
Message 1 of 19
(526 Views)

@ethanFHenry wrote:

Is there any way to wait for a user event and get the data put WITHOUT USING AN EVENT STRUCTURE?  I'm using events because 95% of the time Event structures are easy and the natural thing to do, but sometimes it'd be helpful to just be able to wait for the event without the huge event structure.  Thanks!


No.

 

I love using occurrences in these situations. Don't have LabVIEW on this computer, but there should be examples of them in the example finder.

0 Kudos
Message 2 of 19
(508 Views)

What McDuff said. 

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 3 of 19
(476 Views)

But...

 

The OP wants both signaling *AND* data so occurrences (which are signaling-only, no data) won't be enough.   I think a Notifier would be the thing to use here.   Probably with "ignore previous" set to True by the sounds of things.

 

 

-Kevin P

ALERT! LabVIEW's subscription-only policy came to an end (finally!). Unfortunately, pricing favors the captured and committed over new adopters -- so tread carefully.
Message 4 of 19
(472 Views)

@ethanFHenry wrote:

Is there any way to wait for a user event and get the data put WITHOUT USING AN EVENT STRUCTURE?  I'm using events because 95% of the time Event structures are easy and the natural thing to do, but sometimes it'd be helpful to just be able to wait for the event without the huge event structure.  Thanks!


The earliest versions of LabVIEW did not have an Event Structure!  So, we had to use "polling."   Open the block diagram of the Dialog.vi for an example.

 

In essence you read the control terminal inside a while loop until you saw the data change.  The code smells were bad.

 

The Event Structure is a lot smaller than the alternative number of parallel while loops or convoluted logic needed to handle multiple data value changes.   

 

SUMMARY: You COULD use polling. You SHOULD NOT use polling. 


"Should be" isn't "Is" -Jay
0 Kudos
Message 5 of 19
(465 Views)

@Kevin_Price wrote:

But...

 

The OP wants both signaling *AND* data so occurrences (which are signaling-only, no data) won't be enough.   I think a Notifier would be the thing to use here.   Probably with "ignore previous" set to True by the sounds of things.

 

 

-Kevin P


+1

Missed the data part, thought the OP just wanted to wait for the event.

0 Kudos
Message 6 of 19
(439 Views)

If you're crazy enough, you could make an XNode that does that.

0 Kudos
Message 7 of 19
(434 Views)

@ethanFHenry wrote:

Is there any way to wait for a user event and get the data put WITHOUT USING AN EVENT STRUCTURE?  I'm using events because 95% of the time Event structures are easy and the natural thing to do, but sometimes it'd be helpful to just be able to wait for the event without the huge event structure.  Thanks!

To avoid the huge event structure on your block diagram you can put the event structure in a SubVI.

 

EventStructure in SubVI.PNG

 

 

0 Kudos
Message 8 of 19
(424 Views)

I thought about wrapping the event structure in a malleable VI, but sadly the event structure is not inlineable, such a dumb restriction...

0 Kudos
Message 9 of 19
(415 Views)

@raphschru wrote:

I thought about wrapping the event structure in a malleable VI, but sadly the event structure is not inlineable, such a dumb restriction...


Uhmmmm.. as a rule ThisVI simply can't be deciphered when it is sucked into ThatVI by inlining.  Nor can any Asynchronous Node.  Seriously,  inlined code compiles into the caller without a front panel (just conpane and block diagram)  Events just won't work.   

 

You could TRY to inline an Event Structure that only has dynamic Events and timeout.  I'd be curious if that is allowed. 

 

Kevin mentioned Notifiers.  The Wait on Multiple...was often used to poll for changes from several data sources at a single point.   It was a PITA before the Event structure. 


"Should be" isn't "Is" -Jay
0 Kudos
Message 10 of 19
(404 Views)