You don't need to mess around with the active form calls for FrmDoDialog
dialogs:

  FormType *popForm = FrmInitForm();
  
  // Use the ptr to the form to initialize the form's contents
  
  // This will display the form and draw the contents
  FrmDoDialog();

  // get user input here

  FrmDeleteForm();

One place where it is easy to get into trouble is if you use a custom
routine like GetObjectPtr, which uses FrmGetActiveForm, to initialize a
modal dialog. The FrmDoDialog call automatically makes the dialog the active
form when it is displayed (and not before) and restores the previous active
form when it returns.

Take a look at the sample code that comes with the SDK: either use
CodeWarrior's Find in Files feature or a utility such as grep to search for
all the instances of FrmDoDialog to see how the PIM applications use the
call.

JB @ PalmSource

on 10/11/02 12:47 AM, David Eyler at [EMAIL PROTECTED] wrote:

> I recently saw this comment in the FrmGetActiveForm() API call:
> 
> "You should not call the FrmGetActiveForm function when a popup window is
> open. There is no active form while a popup is displayed, and the value
> returned from FrmGetActiveForm in this situation has no meaning. "
> 
> Does this mean that you can't call FrmGetActiveForm() inside the event
> handlers of FrmDoDialog?  Because I've been doing this regularly with no
> problems.
> 
> Also, is this the correct call sequence for FrmDoDialog()?  I've looked at
> other posts and couldn't find a definitive answer. I'm not sure whether the
> FrmGetActiveForm and FrmSetActiveForm calls are necessary.
> 
> prevForm = FrmGetActiveForm()
> popForm = FrmInitForm()
> FrmSetActiveForm(popForm)
> FrmDrawForm()
> ...drawing stuff here
> FrmDoDialog()
> ...get user input here
> FrmDeleteForm()
> FrmSetActiveForm(prevForm()
> 
> 


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

Reply via email to