--- Steven Fisher <[EMAIL PROTECTED]> wrote:
> 
> I've read that is how it is supposed to work, but I've 
> experimented and found that the Palm never hits my OK button's 
> code. I'm completely at a loss for how it's getting out of this 
> dialog... my theory is that the Home/Launcher button sends some 
> sort of event that triggers FrmDoDialog to immediately return if 
> it can't find a default button.

When you hit the Home button, it sends an appStopEvent which is picked
up by the event loop inside of FrmDoDialog().  When FrmDoDialog() sees
this event, it reposts it to the event queue (so your app can exit its
event loop) and then breaks out of its loop and closes the dialog.

The way Palm expects you to use FrmDoDialog() is to check for the
button that was tapped *after* FrmDoDialog() exits.  The way it
indicates which button was tapped is in the UInt16 returned by the
function.  What you have done is to cleaverly alter the normal behavior
by preventing the OS from ever seeing any button taps other than the OK
button.  Since your code expects to handle the OK button tap inside of
the form event handler, rather than after the dialog closes, it never
gets executed if the user switches to another app.

You could probably solve your problem by moving the code that allows
the user to continue the app (after a correct password) to after the
call to FrmDoDialog().  The program would then work this way:

1. User starts app and sees password dialog.
2. Until the right password is entered...
     - collect button presses and
     - display message about wrong password
3. Continue with the app...

In this situation, the user would have to enter the correct password to
access your app, or he could switch to another app.  But he could not
bypass the password check.

If you don't want users to switch to other apps, then your app has to
intercept the hard keys and soft keys in your event loop and not pass
them on to SysHandleEvent().  How to do this is posted several times in
the archives and is also in the KB.


__________________________________________________
Do You Yahoo!?
Yahoo! - Official partner of 2002 FIFA World Cup
http://fifaworldcup.yahoo.com

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

Reply via email to