LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Is it ok to trigger 2 event loops off the same control?

Solved!
Go to solution

@sfrosty wrote:

I have two event loops which need to trigger when the Exit button is clicked on. Is it ok to trigger both loops off the same control?



There is no problem with that.

 

 

Message 11 of 14
(391 Views)

Thanks! Been running a couple weeks with no issue, but it was brought to my attention on a code review. Wasn't sure if an issue might crop up in the future. Thanks again!

0 Kudos
Message 12 of 14
(379 Views)

Oh, not to say that there isn't a more efficient way to do things. As noted previously.

0 Kudos
Message 13 of 14
(378 Views)

Here's a link to a typical example for this scenario.

 


@crossrulz wrote:
I would recommend moving your menue stuff into your main event loop.  You will thank yourself later.

Tim, I often use a second loop for out-of-band UI stuff. Things like that don't belong in the main event loop.

 

In my case, the main event loop deals with computations as a function of control changes. Often the main recalculation is done in the timeout case and all value change event that need to trigger a recalculation, simply update the data structures and set the timeout to a small value. The timeout case sets the timeout back to -1. The second event loop reacts to value changes of radio buttons and tabs, and shows/hides additional controls as needed. There is also a key down event that listens for e.g. <esc>, which will interrupt any ongoing complicated calculation (e.g. fitting). This cannot be in the main event structure, because that one might be busy doing other stuff.

 

 

Message 14 of 14
(370 Views)