Form Events

There are five form-level events sent by the Form Manager to an application:

frmLoadEvent

This specifies that a form needs to be loaded. While there is no default handling for this event, this is certainly the event for which your application-wide event handler is looking (see Chapter 5). In response to this event, the event handler must do the following:

  • Initialize the form

  • Make it the active form

  • Install an event handler for it

frmOpenEvent

This specifies that a form is being opened. There is no default handling for this event. Your form-specific event handler needs to draw the form (after initializing any form objects that it desires).

Warning

Do not do any drawing to the screen before calling FrmDrawForm (the 3.5 or later debug ROMs will cause an error if you try). You may do initialization of form objects, which will then draw with their new values when the form itself draws. Since the bits underneath for the form are saved on the first FrmDrawForm (see Section 8.2 earlier), you don’t want to do any drawing before that, or the wrong bits will be saved.

frmCloseEvent

This is sent when a form is being closed. The default handling for this event is to erase the form (restoring the bits underneath, if Save Behind is set), and delete it from memory. You’ll often want to look for this event so as to undo the effects of any initialization you did on the frmOpenEvent (e.g., deallocate allocated memory). You’ll still want to return false from your event handler, however, ...

Get Palm OS Programming, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.