>
>
> what user-defined event handler? do you mean the form event handler?
Yes the form event handler that I wrote for the form.
> CtlHandleEvent sure enough sends a ctlEnterEvent for me, on OS3.3. are you
> sure there isn't something more to this problem?
It works for me as well, but when a form is called or switched, however you want
to say it, from my Main Form which is the first initialized, CtlHandleEvent
no longer sends a ctlEnterEvent to any other forms. I open these forms by
calling the function FrmGotoForm. The current form is closed correctly, the new
form is opened corretly, and it does receive penDownEvent.
>
>
> what is the code for your event loop?
static Boolean MainOBSHandleEvent(EventPtr event)
{
Boolean handled;
int delta=0;
FieldPtr fld;
Handle h;
CharPtr s;
FormPtr frm = FrmGetActiveForm();
switch(event->eType)
{
case ctlEnterEvent:
switch(event->data.ctlEnter.controlID)
{
case OBSMainOBS_enterButton:
fld=FrmGetObjectPtr(frm,FrmGetObjectIndex(frm,OBSMainObs_radialField));
h=FldGetTextHandle(fld);
if(h == 0){
handled = true;
break;
}
FldSetTextHandle(fld,NULL);
s=MemHandleLock(h);
delta=StrLen(s);
if(delta == 0 || delta > 3){
MemHandleUnlock(h);
FldFreeMemory(fld);
handled = true;
break;
}
obs_rad=StrAToI(s);
if(obs_rad > 0 && obs_rad < 360){
fld=FrmGetObjectPtr(frm,FrmGetObjectIndex(frm,OBSMainObs_radialField));
FldSetTextHandle(fld,NULL);
MemHandleUnlock(h);
FldFreeMemory(fld);
waypoint_on=1;
handled = true;
FrmGotoForm(GPSMainForm);
break;
}
else{
MemHandleUnlock(h);
FldFreeMemory(fld);
FrmAlert(OBSErrorAlert);
FrmDrawForm(frm);
handled = true;
break;
}
}//end switch ctlEnter
break; //end case ctlSelect
case frmOpenEvent : FrmDrawForm(frm);
FrmSetFocus(frm,FrmGetObjectIndex(frm,OBSMainObs_radialField));
handled = true;
break;
case frmCloseEvent:
fld=FrmGetObjectPtr(frm,FrmGetObjectIndex(frm,OBSMainObs_radialField));
FldSetTextHandle(fld,NULL);
FldFreeMemory(fld);
FrmEraseForm(frm);
FrmDeleteForm(frm);
handled = true;
break;
/*case penDownEvent : FrmGotoForm(GPSMainForm);
handled = true;
break; */
case nilEvent :
//FrmSetFocus(frm,FrmGetObjectIndex(frm,OBSMainObs_radialField));
handled=true;
break;
} // end switch
return(handled);} //end function
>
> what is the code for any non-OS functions called by your event loop?
See above, this is the form event handler for the form that is called.
> does it handle penDownEvent or penUpEvent? if so, what is the code?
Yes, see above.
Thanks,
Jason