This is an abstract base class for any control element Classes.
Note: most objects don't update themselves when modified.
Use the refresh() method to redraw the control. This could
have been done automatically, but for speed reasons, it was not (imagine
a listbox with some 100 elements).
Synopsis
#include <PLUI.h>
You cannot construct any instances of this class, but the minimal constructor is
PControl(PForm* parent, Word id);
to create a control with a parent form from a resource id.
PControl(PForm* parent, VoidPtr objPtr);
to create a control from an object pointer returned by the system.
This is intented to be used internally.
virtual PControl& refresh() = 0;
Redraws the control. This functions
must be implemented by any derived class.
virtual Boolean usable() = 0;
virtual Boolean enabled() = 0;
virtual Boolean visible() = 0;
Return the status attributes for the control. Theses functions
must be implemented by any derived class.
virtual PControl& show(Boolean show);
virtual PControl& show();
virtual PControl& hide();
Set the visibility of the object. This calls FrmShowObject
if your control does not respond to this, you must override these
methods.
virtual PControl& usable(Boolean f);
virtual PControl& enable(Boolean f);
Set the attributes of a control. Does not have an effect on all
controls.
SWord idx();
Returns the object's index in the form if the parent form is already shown,
otherwise it returns -1. This can be used to access PalmOS APIs that need
the object's index and are not implemented yet.
virtual void loadInit();
virtual void unloadExit();
These methods are called when the parent form has been loaded into memory
or is going to be closed.
The default is, to do nothing. Any initialization that can only be done
when a form is loaded should be done in loadInit(). This
can e.g. be setting a text that has been stored in a constructor.
unloadExit().unloadExit is only called when the
application is closed (switch to another application) or if a
PForm::goTo() is issued. In
particular it is not called when a form, which was opened
using PForm::popUp() issues a
PForm::returnTo()
VoidPtr objPtr();
FormPtr frmPtr();
Return a VoidPtr to the controls structure or a
FormPtr to the parent if the parent form is already shown,
otherwise they return 0. These can be used to access PalmOS APIs.