LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Switching between Event Loops

Hello,

From what I have seen Events must be used inside of a loop (usually a while).  I have a tab control and I am trying to switch between event structures as I go from tab to tab.  I was trying to find a way to do this, but it seems that I get stuck trying in the Event structure.  I tried to add the tab switching as an event to trigger on and exit the while loop but this causes me to only one other tab after starting and then nothing else.

All suggestion are appreciated...

Thank you for your support.
0 Kudos
Message 1 of 6
(3,117 Views)
In each event case, wire a constant to the tab control corresponding to the event.  Use local variables or property nodes as necessary to expand to other events.  I don't have access to LV right now. I can post an example when I get access to LV.

Hope this helps
km
0 Kudos
Message 2 of 6
(3,107 Views)
Using two different event structures is not the usual or recomended way. You should read the on-line help for recomendations and caveats about the event structure. An event structure is always capturing events whether it is inside a case statement or not and can lead to lockups when you have two. You should have a single event structure with a value change event for the tab control and take actions based on which tab is active.
0 Kudos
Message 3 of 6
(3,105 Views)
Thank you very much,

I think I understand.  From your explaination, events are global should only exist in parallel with any other code that might be running.  I was curious :
1.) Is there a way to subscribe and unsubscribe any given event, maybe due to some condition?
2.) Can events be used in sub VIs or are they to be limited to only top level VI?

Thank you very much
0 Kudos
Message 4 of 6
(3,062 Views)
Hi swim,

each vi can have it's own event structure, so you can use events in subVis too.

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 5 of 6
(3,055 Views)
You can register for events dynamically. This way it is possible to create conditions for events and to use event structures in subVI, but I would advice you to avoid this kind of solution. If two subVIs use event structures, your application can stuck.

I used the attached VI sometime ago. It worked, but at the end I preferred to transfer the event structure to the main VI and use subVIs to make the job of each event.

Search the LV User Guide for Event Strucutures. It will be helpful.

Regards,
Rasputin
LV7.1 <> W2K
0 Kudos
Message 6 of 6
(3,050 Views)