--- Steven Fisher <[EMAIL PROTECTED]> wrote:
> I have a memory leak (2 blocks) in my application that only 
> happens if the user taps the home/launcher button while in 
> my first modal dialog.

The OS simulates a tap on the default button if you switch to another
app while a modal dialog is up.  Is it possible that the default button
isn't the one you want tapped?  Could it be that the code for one
button releases the memory, but the code for another button doesn't
release the memory?

> ...

> This is my code to present the (true) modal dialog. Is this the right
> technique to use?
> 
>  // Display password form
>  oldActiveFormP = FrmGetActiveForm();
>  formP = FrmInitForm(UnlockForm);
>  FrmSetEventHandler(formP, UnlockFormHandleEvent);
>  FrmSetActiveForm(formP);
>  FrmDrawForm(formP);

I don't think you need FrmDrawForm() here.  I have never had any
problem calling FrmSetFocus() before FrmDoDialog() and FrmDoDialog()
will draw the form for you.  (Unless you are doing something weird in
SetFormFocusById().)

>  SetFormFocusById(formP, UnlockEntryField);
>  FrmDoDialog(formP);
> 
>  // Clean up
>  FrmSetActiveForm(NULL);
>  FrmDeleteForm(formP);
>  FrmSetActiveForm(oldActiveFormP);
> 

You might find this simpler:

  FrmSetActiveForm( oldActiveFormP );
  FrmDeleteForm( formP );

> The code for the OK button does nothing, I just return false 
> to make the dialog close.

FrmDoDialog() closes the dialog when any button on the form is tapped.

If a form's event handler returns false, that means it did not handle
the event.  So, I don't understand where and why you are returning
false.


__________________________________________________
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