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

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? It has been working great, but I'm not sure if there could be an issue. Please see below. Thank You!

 

0 Kudos
Message 1 of 14
(3,102 Views)

I would just question why you have two event structures in the same VI.  In general, you should just have one place that handles GUI events and then you can pass commands off to other processes using queues.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 2 of 14
(3,076 Views)

Ahhh! Good point. I think it's because I decided to include a separate while loop to control my menu after the main code was built and didn't think of inlcluding the menu event in the original event structure. Another point may be that I have  50 ms wired to the timer in the MENU event structure and don't want any delay in the MAIN Event structure. Not sure if this is a valid point.

 

Dual Event Loop trigger.png

0 Kudos
Message 3 of 14
(3,067 Views)
Solution
Accepted by topic author sfrosty

@sfrosty wrote:

Another point may be that I have  50 ms wired to the timer in the MENU event structure and don't want any delay in the MAIN Event structure. Not sure if this is a valid point.


Why?  Are you doing something else in that loop?

 

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


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 4 of 14
(3,061 Views)

Will do! Thanks for your help! Smiley Happy

0 Kudos
Message 5 of 14
(3,043 Views)

Oops! I misread your question:

Why?  Are you doing something else in that loop?

 

Yes, I'm using the MENU timer event case (50ms) to process an Exit global!

0 Kudos
Message 6 of 14
(3,032 Views)

Waiting on Exit global timer event.

 

Exit global.png

0 Kudos
Message 7 of 14
(3,030 Views)

Oh, and I won't need the Exit global loop if I place the menu event case in the main event case. Smiley Wink

0 Kudos
Message 8 of 14
(3,015 Views)
That makes no sense. You should just have a value change event for the exit button. No need for a global and certainly no need to read one in the timeout event.
Message 9 of 14
(3,012 Views)

Got it!

0 Kudos
Message 10 of 14
(3,008 Views)