LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Wait for User Event


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

This is what I intended (there is also a "Timeout" case) (tested in LV2023Q3):

 

raphschru_0-1727276896046.png

I have the error message:

"Event Structure: This object is not allowed in a VI on which you enable inlining. Disable inlining or remove this object."

...even though User Events have nothing to do with the front panel...

 

 


@JÞB wrote:

Uhmmmm.. as a rule ThisVI simply can't be deciphered when it is sucked into ThatVI by inlining.


Why couldn't "ThisVI" and "ThisApplication" (and also unwired VI/App prop/invoke nodes) simply reference the context of the caller VI (more precisely, the first parent that is not inlined) ? Is there a case where the caller context would not be determinable?

 

 


@JÞB wrote:
Nor can any Asynchronous Node [be inlined].

Actually you can inline "Call By Ref", "Start Async Call" and "Wait On Async Call" nodes, at least since LV2020.

 

 

Regards,

Raphaël.

0 Kudos
Message 11 of 19
(402 Views)

@UliB wrote:

@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

 

 


One of the reasons LV NXG died a horrible death is because you can't do this in NXG.

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 12 of 19
(381 Views)

@raphschru wrote:

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

This is what I intended (there is also a "Timeout" case) (tested in LV2023Q3):

 

raphschru_0-1727276896046.png

I have the error message:

"Event Structure: This object is not allowed in a VI on which you enable inlining. Disable inlining or remove this object."

...even though User Events have nothing to do with the front panel...

 

 


@JÞB wrote:

Uhmmmm.. as a rule ThisVI simply can't be deciphered when it is sucked into ThatVI by inlining.


Why couldn't "ThisVI" and "ThisApplication" (and also unwired VI/App prop/invoke nodes) simply reference the context of the caller VI (more precisely, the first parent that is not inlined) ? Is there a case where the caller context would not be determinable?

 

 


@JÞB wrote:
Nor can any Asynchronous Node [be inlined].

Actually you can inline "Call By Ref", "Start Async Call" and "Wait On Async Call" nodes, at least since LV2020.

 

 

Regards,

Raphaël.


While those nodes contain "Asynchronous " in the name...the nodes themselves are not Asynchronous. 

 

ThisVI and ThisApp are easy to replace with controls that can be passed into the inlined code 😀  it even makes the inlined code more readable. Leaving the controls unwired even forces the caller to pass in the default "This"Ref.  Easy peasy lemon squeezey.   The only case where ThisRefs are not able to be determined is during the development of the code to be inlined - so out pops an error forcing a better solution.   It could've probably been just a warning that explained that This would become That when inlined.  NI chose to throw an error. 


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

@raphschru wrote:

raphschru_0-1727276896046.png


Isn't that exactly what Wait on Notifier does?

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

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 14 of 19
(328 Views)

@Yamaeda wrote:

@raphschru wrote:

raphschru_0-1727276896046.png


Isn't that exactly what Wait on Notifier does?


I would rather say, that's what "Wait on Notification with Notifier History" does (with "ignore previous" set to true), because the simple "Wait on Notification" does not work when calling the same node instance repeatedly with different Notifier references.

 

But even then, there are slight differences:

 - The Event Registration refnum's lifetime is independent from the User Event refnum's lifetime.

 - "Register for Events" works even if the User Event refnum is invalid, then the Event Structure will simply time out.

0 Kudos
Message 15 of 19
(302 Views)

@raphschru wrote:

@Yamaeda wrote:

@raphschru wrote:

raphschru_0-1727276896046.png


Isn't that exactly what Wait on Notifier does?


I would rather say, that's what "Wait on Notification with Notifier History" does (with "ignore previous" set to true), because the simple "Wait on Notification" does not work when calling the same node instance repeatedly with different Notifier references.

 

But even then, there are slight differences:

 - The Event Registration refnum's lifetime is independent from the User Event refnum's lifetime.

 - "Register for Events" works even if the User Event refnum is invalid, then the Event Structure will simply time out.


Yeah, this solution will not wait for events sent before this registration occurs, a Wait for notifier will

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

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 16 of 19
(262 Views)

Or you could try creating an Express VI that does it.

0 Kudos
Message 17 of 19
(227 Views)

@paul_a_cardinale wrote:

Or you could try creating an Express VI that does it.


Yeah but an express VI wouldn't react to a data type change like an XNode can, or would it?

0 Kudos
Message 18 of 19
(220 Views)

@raphschru wrote:

@paul_a_cardinale wrote:

Or you could try creating an Express VI that does it.


Yeah but an express VI wouldn't react to a data type change like an XNode can, or would it?


No, but you could make the update to the data type as simple as double-clicking the Express VI, then clicking OK.

0 Kudos
Message 19 of 19
(199 Views)