Setup an event handler for this dialog like this:

   FormPtr dialog = FrmInitForm(YourForm);
   FrmSetEventHandler(dialog , YourFormHandleEvent);
   FrmDoDialog(dialog );
   FrmDeleteForm(dialog );

    Boolean YourFormHandleEvent(EventPtr eventP)
    {
     Boolean handled = false;
     FormPtr frmP = FrmGetActiveForm();
     static UInt32 sec = 0;

     switch (eventP->eType)
      {
      case winEnterEvent:
       if(eventP->data.winEnter.enterWindow == FrmGetWindowHandle(frmP))
       {
        sec= TimGetSeconds();
        EvtSetNullEventTick(5*SysTicksPerSecond());
       }
       break;

      case nilEvent:
       if(TimGetSeconds() - sec > 5)
        CtlHitControl((ControlType *)FrmGetObjectPtr(frmP,
FrmGetObjectIndex(frmP, AboutOKButton)));
       EvtSetNullEventTick(5*SysTicksPerSecond());
       break;

      default:
       break;

      }

     return handled;
    }

It works.

Georgi Kashev
WebVisia

----- Original Message -----
From: "phil" <[EMAIL PROTECTED]>
Newsgroups: palm-dev-forum
To: "Palm Developer Forum" <[EMAIL PROTECTED]>
Sent: Friday, March 29, 2002 11:00 AM
Subject: Dialog form with timeout


> Hi all,
> I would like know the best way to display a dialog form and close it after
5
> seconds if no response is done. Any ideas ?
>
> ----------------------------------------
> Philippe ROSSI
> www.peekpocket.com
> Mail : [EMAIL PROTECTED]
> ----------------------------------------
>
>
>
> --
> For information on using the Palm Developer Forums, or to unsubscribe,
please see http://www.palmos.com/dev/support/forums/
>

-- 
For information on using the Palm Developer Forums, or to unsubscribe, please see 
http://www.palmos.com/dev/support/forums/

Reply via email to