LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Front panel locks with event structure loop and another while loop

Highlighted
Hi, Why is the front panel locking after changing the value of the "boolean switch" twice? This problem disappears if I uncheck the "lock front panel" option in the event case. However I don't understand why that is the case since the event structure loop has already finished executing. thanks
0 Kudos
Message 1 of 9
(1,436 Views)
Highlighted

Can you either post your code or a trimmed down version that exhibits this?

 

You seldom will want to uncheck lock front panel. I am not even sure of the use case for that. And you never want code in an event case that takes a long time to complete. A "long time" means anything that will be noticable to the user. If you _must_ do that then you should set the busy cursor and unset it when the case is done executing.

 

It is much better to send messages from an event handling loop to another loop using anything from a local variable (ugly) to a queue or notifier (pretty)

 

Take a look at the Producer/Consumer Design Pattern (Events) that ships with LabVIEW under File/New/From Template/Frameworks/Design Patterns.

=====================
LabVIEW 2012


0 Kudos
Message 2 of 9
(1,430 Views)
Highlighted

If the event structure loop has finished executing, it means that the event structure can no longer be reached by dataflow. Thus the event can no longer fire and thus can no longer complete, meaning the front panel will lockup forever.

 

An event structure is always active and you should design your diagram accordingly.

 

(See also)


LabVIEW Champion. It all comes together in GCentral GCentral
What does "Engineering Redefined" mean??
Message 3 of 9
(1,424 Views)
Highlighted

Sorry, I thought I'd posted the code! Here it is.

0 Kudos
Message 4 of 9
(1,409 Views)
Highlighted

Is this right: if the event loop has stopped, somehow it's still active. So any event that fits one of its cases will cause it to try to execute that event case, which can't execute since no dataflow, so that case never completes execution, so the front panel locks up?

 

So never allow an event structure loop to finish executing before the entire VI stops if one of the events (e.g. value change of a button) can still be done? 

 

Thanks!

0 Kudos
Message 5 of 9
(1,403 Views)
Highlighted

Do you really want the event handling to stop after detecting the first event? If so then as Christian says the event structure will cause the front panel to lock. What you can do is dynamically register and unregister the events. You right click on the event structure and enable "Show Dynamic Event Terminals" Then  you can programatically register and unregister events.

 

Here is your vi modified to do that.

 

Edit: Just in case - right click on the control and create a reference. When selecting the source of the event in the structure look under the dynamic section.

=====================
LabVIEW 2012


Message 6 of 9
(1,400 Views)
Highlighted

 


@altenbach wrote:

 

An event structure is always active and you should design your diagram accordingly.

 

(See also)


I have never written a vi where the event loop stops while the rest of the vi continues to run. I did not know that. You will never know how many things I have learned from your replies!

 

=====================
LabVIEW 2012


0 Kudos
Message 7 of 9
(1,395 Views)
Highlighted

ok I got it!

Thanks for your replies 🙂

0 Kudos
Message 8 of 9
(1,393 Views)
Highlighted

Thank people with kudos! Smiley Very Happy

 

Edit: (Darned Swype!)

=====================
LabVIEW 2012


0 Kudos
Message 9 of 9
(1,389 Views)