07-16-2008 12:26 PM
07-16-2008 01:00 PM
07-16-2008 02:41 PM
07-16-2008 03:31 PM
07-17-2008 12:05 AM
Well, your loop is completely asymmetric: you have a great "blind" Delay and the rest of code which is executed in a few miliseconds! Additionally, the condition to exit from the loop must be catchable in the loop callback, that is your "j" variable must be global to both this function and at least the stop button callback function. An alternative to this is to use a toggle button as the stop button, with no callback associated to it, then substitute the Delay with something like this:
int stop;
double tini;
while (1) {
tini = Timer ();
while (Timer () - tini < 5.0) {
ProcessSystemEvents ();
GetCtrlVal (panelHandle, PANEL_STOPBUTTON, &stop);
if (stop) break; // Exit the pause loop
}
if (stop) break; // Exit the test loop
// you code goes here
}
As a side note, I point you to a possible typo in your code:
while (j=1) actually assigns the valueof 1 to j variable! You should use while (j==1) instead.