LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Disable Button Problems

I know I'm missing something obvious here, but I can't quite figure it out.  I've attached a simple vi that disables a button based on a checkbox.  This works fine. However, I can't stop the loop to exit the program.  Is the event structure causing this?  How do I get around this issue?

Thanks,
Derek


0 Kudos
Message 1 of 9
(3,762 Views)
Yes, the current loop iteration cannot finish until the event structure executes, and it will only execute if a handled event occurs, of course! 🙂
 
Simply create another event for the stop button as in the attached modification (LAbVIEW 8.0).
 
Also notice that you don't need any wait statements, because the loop only spins if needed. I have placed a loop counter on the iteration terminal for demonstration.

Message Edited by altenbach on 03-01-2006 05:46 PM

0 Kudos
Message 2 of 9
(3,762 Views)
I had a feeling that was the issue.  Here's my sad LabVIEW story.  I'm taking over an existing project with 100+ locals reads & writes and probably 12+ simultaneous while loops all embedded in a 3 sequence structure.  It's not pretty!  Anyways, the stop button is handled in another one of those loops, so how do I stop this particular event loop?

Thanks,
Derek

P.S.  Thanks for the modified code!
0 Kudos
Message 3 of 9
(3,741 Views)
Derek,

It might be faster to start over.

It is hard to tell without seeing the program structure. It is possible to have multiple event structures responding to the same event (Stop - Value change, for example), but sorting out all the possible race conditions in the program you inherited might be tough.

A cleaner way for your case might be to use a queue or a notifier to pass the information from one loop to the other(s).

Lynn
0 Kudos
Message 4 of 9
(3,736 Views)
I would love to start over, but we're in a time crunch and just can't do it right now, unfortunately...
0 Kudos
Message 5 of 9
(3,719 Views)


@DerekSRD wrote:
Anyways, the stop button is handled in another one of those loops, so how do I stop this particular event loop?

That's the beauty of the event structure, you can read the new value from the event terminal and have the button terminal elsewhere. 🙂

See attached modification (LabVIEW 8.0)

Message 6 of 9
(3,714 Views)
That's a really clean solution.  The event structure really seems the best way to handle all the UI controls.  Is this what you generally do when designing a decent (or not so decent) size LabVIEW app?

Thanks again!
0 Kudos
Message 7 of 9
(3,700 Views)

Yes, Derek.  If your VI has anything that a user will be interacting with (i.e., it's not being used as a subVI), then in most cases, you'll want to use an Event Structure.

-D

0 Kudos
Message 8 of 9
(3,684 Views)
To All:

Thanks for all your help on this one!  The example was insignificant, but I now understand how to apply it.

Derek
0 Kudos
Message 9 of 9
(3,678 Views)