LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

front panel iced when i combine event loop and while loop

Why my front panel is completely iced when i use this code??
CLA, CTA, LV Champion
View Cyril Gambini's profile on LinkedIn
This post is made under CC BY 4.0 DEED licensing
0 Kudos
Message 1 of 7
(3,063 Views)
Actually this is not a bug. This is behaviour of your code. Unless the inner while loop is not stopped, the vi won't react although the events of the buttons are generated an catched by the event structure.
Using LV8.0
--------------------------------------------------------------------
Don't be afraid to rate a good answer... 😉
--------------------------------------------------------------------
Message 2 of 7
(3,060 Views)
zyl7,

becktho is completly rigth, this is expected behaviour. You are running into one caveat with event-structures: Don't stack UI-controlled loops (stop button!) within event-structures!
You can find a small list of "Not to Do's with event structures" here.

Norbert B.
NI Germany
Norbert
----------------------------------------------------------------------------------------------------
CEO: What exactly is stopping us from doing this?
Expert: Geometry
Marketing Manager: Just ignore it.
Message 3 of 7
(3,055 Views)
Does that mean i cannot use a while loop inside an event structure?
CLA, CTA, LV Champion
View Cyril Gambini's profile on LinkedIn
This post is made under CC BY 4.0 DEED licensing
0 Kudos
Message 4 of 7
(3,052 Views)

Basically you can do whatever you want.

But it is not intended to use this way. Loops or other blocking calls (like dialogs or message boxes) in an event structure, are absolute "don't"s.

I suggest you to have a look at the producer/consumer pattern, which is very useful in combination with an event structure.

Using LV8.0
--------------------------------------------------------------------
Don't be afraid to rate a good answer... 😉
--------------------------------------------------------------------
Message 5 of 7
(3,047 Views)
zyl7,

well, you can, but it should not be terminated by the UI. If the loop terminates on its own, thats quite ok. But you should keep in mind that the eventstructure itself will keep on queueing events for UI-interaction from the customer, so if the loop itself runs a long time, the behaviour would NOT be very nice.
If you need an architecture which can handle such cases, you should take a look into the frameworks in the VI templatebrowser (select File->New)

Norbert B.
Norbert
----------------------------------------------------------------------------------------------------
CEO: What exactly is stopping us from doing this?
Expert: Geometry
Marketing Manager: Just ignore it.
Message 6 of 7
(3,045 Views)
Ok!!! thank you very much!!
CLA, CTA, LV Champion
View Cyril Gambini's profile on LinkedIn
This post is made under CC BY 4.0 DEED licensing
0 Kudos
Message 7 of 7
(3,035 Views)