Hi, 
I have a question here. I built an application for downloading data from
another device. In the application, I created an infinite loop for getting
data all the time unless the user push "done" button in order to terminate
the loop and finish downloading. I did the following steps for making "done"
button work. However, when I tested it, it didn't do anything. The infinite
loop was still running.

I declare runLoop as varible to handle button.
char      runLoop = 0;

In the form handler function,

static Boolean ldu_handler(EventPtr event) 
{       // handles the events within the ldu form
        FormPtr   form;
        UInt       handled = 0;
        UInt          index;
        VoidHand      RecHandle;
        Ptr           RecPointer;
        
        
        form = FrmGetActiveForm();

        .............
        //Here I ste up controlID for "done" button.    
        case ctlSelectEvent:
                if (event->data.ctlEnter.controlID== buttonID_ldu_done) 
                        {       // if user pushes the done button, return to
main form
                   runLoop = 0;
                        FrmGotoForm(formID_main);
                        handled = 1; 
                }
                        break;
        .............   
        return handled;
}

In the main function, I had the loop in the function

static void do_channel()
{
        
      runLoop = 1;  //I set runLoop =1 so i can start download date. if
runLoop = 0, downloading shall stop.
//Handle_Old_MF_Data();
while (runLoop)
 {      
        ...............
}

}


Any advice will very appreciated.

Allen

Reply via email to