ni.com is currently undergoing scheduled maintenance.

Some services may be unavailable at this time. Please contact us for help or try again later.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Stopping a while loop with a button in cvi

Hi people,

I am a newbie with CVI but I have used LabView Heaps. The issue I have is I want to be able to use a toggle button or a command button to stop a while loop. I used GetCtrlVal on the toggle before the while loop. I then enter the while loop and then GetCtrlVal at the end to see if the button has been pressed. The issue I have is that once I enter the loop I am unable to press any buttons on the Panel. I would normally have put a delay in the loop but the issue is I am wanting to control a robot in "realtime", thus any delays in the program results in the robot moving further than what I wanted it to. Any ideas? If you have any suggestions that would be much appreciated thank you.
0 Kudos
Message 1 of 3
(2,803 Views)
This should be in the CVI group but...

At the tail end of your while loop add a call to function ProcessDrawEvents():

When your program executes in a callback function or in code that does not call RunUserInterface or GetUserEvent, LabWindows/CVI does not update the user interface. Functions that are overly time-consuming can "lock out" user interface updates. To allow LabWindows/CVI to process these updates, call ProcessDrawEvents.
Message 2 of 3
(2,801 Views)
Thanks Chaos ill try that. I am sorry i posted it in Labview I thought I had posted the thread in labwindows.
0 Kudos
Message 3 of 3
(2,789 Views)