LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

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!!.
0 Kudos
Message 1 of 3
(2,924 Views)
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!!.
0 Kudos
Message 2 of 3
(2,924 Views)
I have the same problem.
If I have the solution, I contact you. Give me your e-mail address at
sebastien.garnier@lamrc.com
if you have the solution before me, send me at this address.
Thanks.
A french guy who works in the states.
0 Kudos
Message 3 of 3
(2,924 Views)