Call ProcessSystemEvents() in your loop.
Have the button set a flag to stop processing.
Here is a trivial example.
Be carefull to check that the DoSomething doesn't
get called while it is already running. I usually check
the running flag before starting the main part of the
loop, and exit if the loop is already running.
Regards,
Reed.
// Global flag to stop loop processing.
int running = 0
int CVICALLBACK DoSomething (int panel, int control, int event,
void *callbackData, int eventData1, int eventData2)
{
if (running) // Already in loop, called again by another control.
exit 0;
// Setup code
...
running = 1;
while (running)
{
AcquireData();
DrawGraphic();
ProcessSystemEvents(); // Allows other
}
// Cleanup code
.....
return 0;
}
int CVICALLBACK StopButton (int panel, int control, int event,
void *callbackData, int eventData1, int eventData2)
{
if (event == EVENT_COMMIT)
running = 0;
}
//----------------------------------------------------------
Reed Blake
Beta Technology
Industrial and Scientific Computing
-----Original Message-----
From: JAD
Newsgroups: natinst.public.labwindows-cvi.general
Date: Tuesday, October 10, 2000 12:47 PM
Subject: ASSIGN A BIGGER PRIORITY
>
>Hi!!
>The problem is that I have a panel who does some operations (adquire data
>and draw a graphic) but I want to put a button to stop this operations
before
>they finish. This go well but I haven't got the possibility of click the
>button before the operation are being done, so I can't stop them. I think
>that I should have to ASSIGN a BIGGER PRIORITY to the button of stop. But
>HOW??
>Thanks!!.