09-24-2024 05:39 PM
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!
09-24-2024 06:36 PM
@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.
09-25-2024 06:27 AM
What McDuff said.
09-25-2024 06:35 AM
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
09-25-2024 06:51 AM - edited 09-25-2024 06:59 AM
@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.
09-25-2024 07:59 AM
@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.
09-25-2024 08:28 AM
If you're crazy enough, you could make an XNode that does that.
09-25-2024 08:39 AM
@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.
09-25-2024 08:52 AM
09-25-2024 09:24 AM - edited 09-25-2024 09:35 AM
@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.