Hi, 
I got an infinite loop , and I use the following code for stopping the loop.
However, it doesn't work. I will very appreciated any suggestion.

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();

        switch (event->eType) 
        {
                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;
                

                case nilEvent:
                        handled = 1;
                        break;

                }
        return handled;
}
static void do_channel()
{
............................
runLoop = 1;
while (runLoop)
 {      
        ............  //I am doing something else here before getting into
the event

//when I debug the "if" loop, each time, the program gets "event.eType
==ctlSlectEvent"statement, and then get out //of loop right away. I think
that the statement cause error somehow. But I am not sure how fix it if it
is the problem. 
if (EvtEventAvail())
    {
      EventType event;
      EvtGetEvent(&event, 0);

      if (event.eType == ctlSelectEvent)  
 
    {
        if (event.data.ctlEnter.controlID == buttonID_ldu_done);
        runLoop = 0;  
       
     }
     
    }

}
 FrmGotoForm(formID_main); // loop done; goto main form
        
}

Thanks as advance.

Allen

Reply via email to