PForm


This class represents a Form resource with all it's controls. You need one instance of this class as a parent for any control. Creating only an object of this class is almost useless without an attached PFormHandler.

Synopsis

#include <PLUI.h>

Derivation

  • PForm
  • PApplication
  • Constructors

        PForm(Word formId);
    
    Creates an object representing the resource formId.

    Public functions

        PForm& goTo();
        PForm& popUp();
    
    Shows the form. popUp() does not close the current form, so the new one overlaps it.
    goTo()closes and thereby replaces the current form. goTo() is not necessary for the main application form, this is done by PApplication::run().


        PForm& returnTo(const PForm* form = 0);
    
    Erase the the form and return to the specified one. If none is given, return to the previous form.
    Note: This does not send a PFormHandler::closed() event to any attached handler!


        Word doDialog();
    
    Shows the form as a dialog. No event processing is done. The form is shown until a button is pressed. If there's no button, you're stuck ;-) The resource id of the pressed button is returned. No child controls are accessible afterwards. If the form has been loaded before, its values and child controls are preserved. This is simplified processing only, use PForm::popUp() for elaborate processing.


        static void msgBox(Word alertId,
    
                           const PString& s1 = "",
                           const PString& s2 = "",
                           const PString& s3 = "");
    
    
    Shows a alert resource replacing the ^1, ^2 and ^3 variables in the message section (if present).


        static void help(Word helpId);
    
    
    Shows a help box with the given string resource.


        PString label(Word labelId);
        PForm&  label(Word labelId, const PString& text);
    
    Retrieve and set the text of label resource.


        PForm& updateForm(Word code = frmRedrawUpdateCode);
    
    Sends an PFormHandler::update(Word) to the attached handlers.


        FormPtr frmPtr() const;
    
    Returns the FormPtr if the form is already shown, otherwise it returns 0. This can be used to access PalmOS APIs that are not implemented yet.


        Word id() const;
    
    Returns the resource id of the form.

    Protected functions

        PForm& addChild(PControl* ctl);
    
    Adds a PControl object as a child. If you override this method, you should call PForm::addChild otherwise your controls don't get initialized.