LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to stop a while loop inside an event handler?

I need to switch between two while loops triggered by an event (i.e. value change of a slide bar).  How do I stop the loop in "timeout" case when the slide bar is active and vice versa?  Attached is the unfinished code. 
 
Thanks,
Shan
0 Kudos
Message 1 of 5
(3,062 Views)

Maybe you should rethink your program layout. Why do you even need loops inside the event structure? These tend to gum up the gears because they are preventing the event to finish, blocking all othere events.

Could you explain what you are trying to do. I am sure there is a better and much simpler solution that deos not require loops inside the event cases. 🙂

0 Kudos
Message 2 of 5
(3,056 Views)

Thanks for the quick replay!  I have an imaq card and want to adjust brightness and contrast during "grab".  The "grab" routine consists a while loop (imaq sample that comes with Labview 7.1).  Since I can not make changes to the brightness and contrast after a "grab" starts, I found a posting that uses an event handler to stop the grab, set new values, then restart a new "grab" with updated value.  I kept having problems with that approach and funneled down the issue to the one in my first post.

Here is the link to that post: http://forums.ni.com/ni/board/message?board.id=200&message.id=1059&requireLogin=False

Shan 

0 Kudos
Message 3 of 5
(3,050 Views)
 
With kind regards

Martin Kunze

KDI Digital Instrumentation.com
e-mail: martin.kunze@digital-instrumentation.com
Tel: +49 (0)441 9490852
0 Kudos
Message 4 of 5
(3,035 Views)

Hi,
I would use globals or Occurrences to solve this problem.
You can use user events too but globals might do the job.

With kind regards

   

With kind regards

Martin Kunze

KDI Digital Instrumentation.com
e-mail: martin.kunze@digital-instrumentation.com
Tel: +49 (0)441 9490852
0 Kudos
Message 5 of 5
(3,035 Views)