Form.h
declares the API that this chapter describes. For more information on forms, see the section "Forms, Windows, and Dialogs" in the Palm OS Programmer's Companion.
FormAttrType
bit field defines the visible characteristics of the form.
typedef struct {
    UInt16 usable :1;
    UInt16 enabled :1;
    UInt16 visible :1;
    UInt16 dirty :1;
    UInt16 saveBehind :1;
    UInt16 graffitiShift :1;
    UInt16 globalsAvailable : 1;
    UInt16 doingDialog : 1;
    UInt16 exitDialog : 1;
    UInt16 reserved :7;
    UInt16 reserved2;
} FormAttrType;
FormAttrType
bit field as opaque. Do not attempt to change bit field member values directly.
globalsAvailable
, doingDialog
, and exitDialog
flags are present only if 3.5 New Feature Set is present.
FormBitmapType
structure defines the visible characteristics of a bitmap on a form.
typedef struct {
    FormObjAttrType attr;
    PointType pos;
    UInt16 rscID;
} FormBitmapType;
attr
|
See FormObjAttrType .
|
pos
| Location of the bitmap. |
rscID
|
Resource ID of the bitmap. If you use DmGetResource with this value as the resource ID, it returns a pointer to a BitmapType structure.
|
FormFrameType
structure defines a frame that appears on the form.
typedef struct {
    UInt16 id;
    FormObjAttrType attr;
    RectangleType rect;
    UInt16 frameType;
} FormFrameType;
id
| ID of the frame. |
attr
|
See FormObjAttrType .
|
rect
| Location and size of the frame. |
frameType
| The type of frame. |
FormGadgetAttrType
bit field defines a gadget's attributes.
typedef struct {
    UInt16 usable : 1;
    UInt16 extended : 1;
    UInt16 visible : 1;
    UInt16 reserved : 13;
} FormGadgetAttrType;
FormGadgetAttrType
structure as opaque. Use the functions specified in the descriptions below to retrieve and set each value. Do not attempt to change structure member values directly.
usable
|
Not set if the gadget is not considered part of the current interface of the application, and it doesn't appear on screen. This is set by FrmShowObject and cleared by FrmHideObject .
|
extended
|
If set, the gadget is an extended gadget. Extended gadgets are supported if 3.5 New Feature Set is present. An extended gadget has the handler field defined in its FormGadgetType . If not set, the gadgets is a standard gadget compatible with all releases of Palm OS®.
|
visible
|
Set or cleared when the gadget is drawn or erased. FrmHideObject clears this value. You should set it explicitly in the gadget's callback function (if it has one) in response to a draw request.
|
reserved
| Reserved for future use. |
FormGadgetType
structure defines a gadget object that appears on a form.
typedef struct{
    UInt16 id;
    FormGadgetAttrType attr;
    RectangleType rect;
    const void * data;
    FormGadgetHandlerType *handler;
}FormGadgetType;
FormGadgetType
structure as opaque. Use the functions specified in the descriptions below to retrieve and set each value. Do not attempt to change structure member values directly.
attr
field was of type
FormObjAttrType
and the handler
field did not exist.
FormLabelType
structure defines a label that appears on a form.
typedef struct {
    UInt16 id;
    PointType pos;
    FormObjAttrType attr;
    FontID fontID;
    UInt8 reserved;
    Char * text;
} FormLabelType;
FormLabelType
structure as opaque. Do not attempt to change structure member values directly.
id
| Resource ID of the label. |
pos
| Location of the label. |
attr
|
See FormObjAttrType .
|
fontID
| Font ID of the font used for the label. |
reserved
| Reserved for future use. |
text
| Text of the label. |
FormLineType
structure defines a line appearing on a form.
typedef struct {
    FormObjAttrType attr;
    PointType point1;
    PointType point2;
} FormLineType;
FormLineType
structure as opaque. Do not attempt to change structure member values directly.
FormObjAttrType
bit field defines a form object's attributes.
typedef struct {
    UInt16 usable : 1;
    UInt16 reserved : 15;
} FormObjAttrType;
FormObjAttrType
structure as opaque. Do not attempt to change structure member values directly.
usable
| Not set if the object is not considered part of the current interface of the application, and it doesn't appear on screen. |
reserved
| Reserved for future use. |
FormObjectKind
enum specifies values for the objectType
field of the
FormObjListType
. It specifies how to interpret the object
field.
enum formObjects {
    frmFieldObj,
    frmControlObj,
    frmListObj,
    frmTableObj,
    frmBitmapObj,
    frmLineObj,
    frmFrameObj,
    frmRectangleObj,
    frmLabelObj,
    frmTitleObj,
    frmPopupObj,
    frmGraffitiStateObj,
    frmGadgetObj,
    frmScrollbarObj,
};
typedef enum formObjects FormObjectKind;
FormObjectType
union points to the C structure for a user interface object that appears on the form.
typedef union {
    void * ptr;
    FieldType* field;
    ControlType* control;
    GraphicControlType * graphicControl;
    SliderControlType * sliderControl;
    ListType* list;
    TableType* table;
    FormBitmapType* bitmap;
    FormLabelType * label;
    FormTitleType* title;
    FormPopupType* popup;
    FormGraffitiStateType* grfState;
    FormGadgetType* gadget;
    ScrollBarType * scrollBar;
} FormObjectType;
FormObjectType
structure as opaque. Do not attempt to change structure member values directly.
graphicControl
and sliderControl
fields are only defined if 3.5 New Feature Set is present.
FormObjectListType
structure specifies a user interface object that appears on the form.
typedef struct {
    FormObjectKind objectType;
    UInt8 reserved;
    FormObjectType object;
} FormObjListType;
FormObjListType
structure as opaque. Do not attempt to change structure member values directly.
objectType
|
Specifies the type of the object (control, field, etc.). See FormObjectKind .
|
reserved
| Reserved for future use. |
object
|
The C data structure that defines the object. See FormObjectType .
|
FormPopupType
structure defines a popup list that appears on a form.
typedef struct {
    UInt16 controlID;
    UInt16 listID;
} FormPopupType;
FormPopupType
structure as opaque. Do not attempt to change structure member values directly.
controlID
| Resource ID of the popup trigger control that triggers the list's display. |
listID
| Resource ID of the list object that defines the popup list. |
FormPtr
type defines a pointer to a
FormType
structure.
typedef FormType * FormPtr;
FormRectangleType
structure defines a rectangle that appears on the form.
typedef struct {
    FormObjAttrType attr;
    RectangleType rect;
} FormRectangleType;
FormRectangleType
structure as opaque. Do not attempt to change structure member values directly.
FormTitleType
structure defines the title of the form.
typedef struct {
    RectangleType rect;
    char * text;
} FormTitleType;
FormTitleType
structure as opaque. Do not attempt to change structure member values directly.
FormType
structure and supporting structures are defined as follows:
typedef struct {
    WindowType window;
    UInt16 formId;
    FormAttrType attr;
    WinHandle bitsBehindForm;
    FormEventHandlerType * handler;
    UInt16 focus;
    UInt16 defaultButton;
    UInt16 helpRscId;
    UInt16 menuRscId;
    UInt16 numObjects;
    FormObjListType * objects;
} FormType;
FormType
structure as opaque. Do not attempt to change structure member values directly.
window
|
Structure of the window object that corresponds to the form. See WindowType .
|
formId
| ID number of the form, specified by the application developer. This ID value is part of the event data of frmOpenEvent. The ID should match the form's resource ID. |
attr
|
Form object attributes. See FormAttrType .
|
bitsBehindForm
| Used to save all the bits behind the form so the screen can be properly refreshed when the form is closed. Use this attribute for modal forms. |
handler
| Routine called when the form needs to handle an event. You typically set this in your application's event handling function. |
focus
|
Index of a field or table object within the form that contains the focus. Any keyDownEvent is passed to the object that has the focus. Set to noFocus if no object has the focus.
|
defaultButton
|
Resource ID of the object defined as the default button. This value is used by the routine FrmDoDialog .
|
helpRscId
| Resource ID number of the help resource. The help resource is a String resource (type tSTR). |
menuRscId
| ID number of a menu bar to use if the form has a menu, or zero if the form doesn't have a menu. |
numObjects
| Number of objects contained within the form. |
objects
|
Pointer to the array of objects contained within the form. See FormObjListType .
|
FrmGraffitiStateType
structure defines the graffiti shift indicator.
typedef struct{
    PointerType pos;
}FrmGraffitiStateType;
FrmGraffitiStateType
structure as opaque. Do not attempt to change structure member values directly.
UInt16 FrmAlert (UInt16 alertId)
FrmCustomResponseAlert
void FrmCloseAllForms (void)
PilotMain()
; that is, before termination.
FrmSaveAllForms
void FrmCopyLabel (FormType *formP, UInt16 labelID, const Char * newLabel)
  |
-> |
Pointer to the form object ( FormType structure). |
  |
-> |
ID of form label object. |
  |
-> |
Pointer to a NULL -terminated string. |
usable
attribute and the label's visible
attribute are set.
FrmHideObject
, then show it using
FrmShowObject
, after using FrmCopyLabel
.
FrmGetLabel
void FrmCopyTitle (FormType *formP, const Char *newTitle)
  |
-> |
Pointer to the form object ( FormType structure). |
  |
-> |
Pointer to the new title string. |
FrmGetTitle,
FrmSetTitle
UInt16 FrmCustomAlert (UInt16 alertId, const Char *s1, const Char *s2, const Char *s3)
  |
-> |
Resource ID of the alert. |
  |
-> |
Strings to replace ^1, ^2, and ^3 (see Comments). |
NULL
for the arguments s1
, s2
, and s3
. If you want an argument to be ignored, pass the empty string (""
). In Palm OS 2.0 or below, pass a string containing a space (" "
) instead of the empty string.
FrmCustomResponseAlert
UInt16 FrmCustomResponseAlert (UInt16 alertId, const Char *s1, const Char *s2,
const Char *s3, Char *entryStringBuf, Int16 entryStringBufLength, FormCheckResponseFuncPtr callback)
  |
-> |
Resource ID of the alert. |
  |
-> |
Strings to replace ^1, ^2, and ^3. See the Comments in FrmCustomAlert for more information. |
  |
<- |
The string the user entered in the text field. |
  |
-> |
The maximum length for the string in entryStringBuf . |
  |
-> |
A callback function that processes the string. See FormCheckResponseFunc . Pass NULL if there is no callback. |
FrmCustomAlert
in these ways:
entryStringBuf
parameter. callback
function is called and is passed the button number and entryStringBuf
. The dialog is only dismissed if the callback returns true
. This behavior allows you to perform error checking on the string that the user entered and give the user a chance to re-enter the string. void FrmDeleteForm (FormType *formP)
formGadgetDeleteCmd
. See
FormGadgetHandler.
Boolean FrmDispatchEvent (EventType *eventP)
.
(If the form's event handler returns false
, the event is passed to FrmHandleEvent
.) This function also returns false if the form specified in the event is invalid.
UInt16 FrmDoDialog (FormType *formP)
FrmInitForm
,
FrmCustomAlert
,
FrmCustomResponseAlert
void FrmDrawForm (FormType *formP)
saveBehind
form attribute is set and the form is visible, this function saves the bits behind the form using the bitsBehindForm field in the FormType
structure.
frmOpenEvent
.
frmUpdateEvent
as well as frmOpenEvent
, and be sure to return true to specify that the frmUpdateEvent
was handled. The default event handler for frmUpdateEvent
calls FrmDrawForm
, so if you allow the event to fall through by returning false
, your custom drawing is erased.
FrmDrawForm
erases the form's window before performing any drawing. Thus, it is especially important to do any custom drawing after this function call on Palm OS 3.5 and higher.
formGadgetDrawCmd
. See
FormGadgetHandler.
FrmEraseForm
,
FrmInitForm
void FrmEraseForm (FormType *formP)
FormType *FrmGetActiveForm (void)
UInt16 FrmGetActiveFormID (void)
FrmGetActiveForm
UInt16 FrmGetControlGroupSelection (FormType *formP, UInt8 groupNum)
  |
-> |
Pointer to the form object ( FormType structure). |
  |
-> |
Control group number. |
frmNoSelectedControl
if no item is selected.
NOTE:  FrmSetControlGroupSelection
sets the selection in a control group based on an object ID, not its index, whichFrmGetControlGroupSelection
returns.
Byte
instead of UInt16
.
Int16 FrmGetControlValue (const FormType *formP, UInt16 controlID)
  |
-> |
Pointer to the form object ( FormType structure). |
  |
-> |
Index of the control object in the form object's data structure. You can obtain this by using FrmGetObjectIndex . |
value
field.
FrmSetControlValue
FormType *FrmGetFirstForm (void)
NULL
if there are no forms.
UInt16 FrmGetFocus (const FormType *formP)
noFocus
if none does. To convert the object index to an ID, use FrmGetObjectId.
void FrmGetFormBounds (const FormType *formP, RectangleType *rP)
  |
-> |
Pointer to the form object ( FormType structure). |
  |
<- |
Pointer to a RectangleType structure where the bounds is returned. |
r
.
UInt16 FrmGetFormId (FormType *formP)
FrmGetFormPtr
FormType *FrmGetFormPtr (UInt16 formId)
FrmGetFormId
data
field of the gadget object.
void *FrmGetGadgetData (const FormType *formP, UInt16 objIndex)
  |
-> |
Pointer to the form object ( FormType structure). |
  |
-> |
Index of the gadget object in the form object's data structure. You can obtain this by using FrmGetObjectIndex . |
data
field of a gadget object contains a pointer to the custom object's data structure.
FrmSetGadgetData
,
FrmSetGadgetHandler
const Char *FrmGetLabel (FormType *formP, UInt16 labelID)
  |
-> |
Pointer to the form object ( FormType structure). |
  |
-> |
ID of the label object. |
FrmCopyLabel
UInt16 FrmGetNumberOfObjects (const FormType *formP)
FrmGetObjectPtr
,
FrmGetObjectId
void FrmGetObjectBounds (const FormType *formP, UInt16 ObjIndex, RectangleType *rP)
  |
-> |
Pointer to the form object ( FormType structure). |
  |
-> |
Index of an object in the form. You can obtain this by using FrmGetObjectIndex . |
  |
<- |
Pointer to a RectangleType structure where the object bounds are returned. The bounds are in window-relative coordinates. |
r
.
UInt16 FrmGetObjectId (const FormType *formP, UInt16 objIndex)
  |
-> |
Pointer to the form object ( FormType structure). |
  |
-> |
Index of an object in the form. You can obtain this by using FrmGetObjectIndex . |
frmInvalidObjectId
if the objIndex
parameter is invalid.
FrmGetObjectPtr
UInt16 FrmGetObjectIndex (const FormType *formP, UInt16 objID)
  |
-> |
Pointer to the form object ( FormType structure). |
  |
-> |
ID of an object in the form. |
FrmGetObjectIndex
, you need to pass the bitmap's resource ID, not the ID of the form bitmap object. (Passing the ID of the form bitmap object may or may not give you the right object back, depending on how you created the objects.)
FrmGetObjectIndex
to get at the second one; it'll always return the first.
void FrmGetObjectPosition (const FormType *formP, UInt16 objIndex, Coord *x, Coord *y)
  |
-> |
Pointer to the form object ( FormType structure). |
  |
-> |
Index of an object in the form. You can obtain this by using FrmGetObjectIndex . |
  |
<- |
Pointers where the window-relative x and y positions of the object are returned. These locate the top-left corner of the object. |
void *FrmGetObjectPtr (const FormType *formP, UInt16 objIndex)
  |
-> |
Pointer to the form object ( FormType structure). |
  |
-> |
Index of an object in the form. You can obtain this by using FrmGetObjectIndex . |
FormObjectKind FrmGetObjectType (const FormType *formP, UInt16 objIndex)
  |
-> |
Pointer to the form object ( FormType structure). |
  |
-> |
Index of an object in the form. You can obtain this by using FrmGetObjectIndex . |
FormObjectKind
.
const Char *FrmGetTitle (const FormType *formP)
NULL
if there is no title string or there is an error finding it.
WinHandle FrmGetWindowHandle (const FormType *formP)
WindowType
, this is also a WinHandle.
void FrmGotoForm (UInt16 formId)
FrmPopupForm
Boolean FrmHandleEvent (FormType *formP, EventType *eventP)
  |
-> |
Pointer to the form object ( FormType structure). |
  |
-> |
Pointer to the event data structure ( EventType ). |
FrmDispatchEvent
instead. FrmDispatchEvent
passes events to a form's custom event handler and then, if the event was not handled, to this function.
FrmHandleEvent
handles different events.
FrmHandleEvent
only handles frmTitleSelectEvent
, menuCmdBarOpenEvent
, frmGadgetEnterEvent
, and frmGadgetMiscEvent
if 3.5 New Feature Set is present.
FrmDispatchEvent
void FrmHelp (UInt16 helpMsgId)
usable
bit) so that it does not redraw or respond to the pen.
void FrmHideObject (FormType *formP, UInt16 objIndex)
  |
-> |
Pointer to the form object ( FormType structure). |
  |
-> |
Index of an object in the form. You can obtain this by using FrmGetObjectIndex . |
usable
bit of the object attribute data to false
. On an OS version prior to 3.2 you can work around this bug by directly setting this bit to false
yourself.
formGadgetEraseCmd
. See
FormGadgetHandler.
FrmShowObject
FormType *FrmInitForm (UInt16 rscID)
FrmDeleteForm
to release the form memory when you are done with the form. Alternatively, you can free the active form by calling FrmReturnToForm
.
FormBitmapType *FrmNewBitmap (FormType **formPP, UInt16 ID, UInt16 rscID, Coord x, Coord y)
  |
-> |
Symbolic ID of the bitmap, specified by the developer. By convention, this ID should match the resource ID (not mandatory). |
  |
-> |
Numeric value identifying the resource that provides the bitmap. This value must be unique within the application scope. |
  |
-> |
Horizontal coordinate of the upper-left corner of the bitmap's boundaries, relative to the window in which it appears. |
  |
-> |
Vertical coordinate of the upper-left corner of the bitmap's boundaries, relative to the window in which it appears. |
FrmRemoveObject
FormType *FrmNewForm (UInt16 formID, const Char *titleStrP, Coord x, Coord y, Coord width, Coord height, Boolean modal, UInt16 defaultButton, UInt16 helpRscID, UInt16 menuRscID)
  |
-> |
Symbolic ID of the form, specified by the developer. By convention, this ID should match the resource ID (not mandatory). |
  |
-> |
Pointer to a string that is the title of the form. |
  |
-> |
Horizontal coordinate of the upper-left corner of the form's boundaries, relative to the window in which it appears. |
  |
-> |
Vertical coordinate of the upper-left corner of the form's boundaries, relative to the window in which it appears. |
  |
-> |
Width of the form, expressed in pixels. Valid values are 1 -160. |
  |
-> |
Height of the form, expressed in pixels.Valid values are 1 -160. |
  |
-> |
true specifies that the form ignores pen events outside its boundaries. |
  |
-> |
Symbolic ID of the button that provides the form's default action, specified by the developer. |
  |
-> |
Symbolic ID of the resource that provides the form's online help, specified by the developer. Only modal dialogs can have help resources. |
  |
-> |
Symbolic ID of the resource that provides the form's menus, specified by the developer. |
WinValidateHandle
,
FrmRemoveObject
FormGadgetType *FrmNewGadget (FormType **formPP, UInt16 id, Coord x, Coord y, Coord width, Coord height)
  |
-> |
Symbolic ID of the gadget, specified by the developer. By convention, this ID should match the resource ID (not mandatory). |
  |
-> |
Horizontal coordinate of the upper-left corner of the gadget's boundaries, relative to the window in which it appears. |
  |
-> |
Vertical coordinate of the upper-left corner of the gadget's boundaries, relative to the window in which it appears. |
  |
-> |
Width of the gadget, expressed in pixels. Valid values are 1 - 160. |
  |
-> |
Height of the gadget, expressed in pixels.Valid values are 1 - 160. |
FrmRemoveObject
FrmGraffitiStateType *FrmNewGsi (FormType **formPP, Coord x, Coord y)
  |
-> |
Horizontal coordinate of the upper-left corner of the Graffiti shift indicator's boundaries, relative to the window in which it appears. |
  |
-> |
Vertical coordinate of the upper-left corner of the Graffiti shift indicator's boundaries, relative to the window in which it appears. |
FrmCustomResponseAlert
).
FrmRemoveObject
FormLabelType *FrmNewLabel (FormType **formPP, UInt16 ID, const Char *textP, Coord x, Coord y, FontID font)
  |
-> |
Symbolic ID of the label, specified by the developer. By convention, this ID should match the resource ID (not mandatory). |
  |
-> |
Pointer to a string that provides the label text. This string is copied into the label structure. |
  |
-> |
Horizontal coordinate of the upper-left corner of the label's boundaries, relative to the window in which it appears. |
  |
-> |
Vertical coordinate of the upper-left corner of the label's boundaries, relative to the window in which it appears. |
  |
-> |
Font with which to draw the label text. |
CtlValidatePointer
,
FrmRemoveObject
Boolean FrmPointInTitle (const FormType *formP, Coord x, Coord y)
  |
-> |
Pointer to the form object ( FormType structure). |
  |
-> |
Window-relative x and y coordinates. |
true
if the specified coordinate is in the form's title.
void FrmPopupForm (UInt16 formId)
FrmGotoForm
in that the current form is not closed. You can call
FrmReturnToForm
to close a form opened by FrmPopupForm
.
Err FrmRemoveObject (FormType **formPP, UInt16 objIndex)
  |
-> |
The object to remove, specified as an index into the list of objects installed in the form. You can use the FrmGetObjectIndex function to discover this value. |
FrmNewBitmap
,
FrmNewForm
,
FrmNewGadget
,
FrmNewLabel
,
CtlNewControl
,
FldNewField
,
LstNewList
FrmRestoreActiveState (stateP)
  |
-> |
A pointer to the FormActiveStateType structure that you passed to FrmSaveActiveState when you saved the state. |
FrmSaveActiveState
to save the state.
void FrmReturnToForm (UInt16 formId)
FrmReturnToForm
does not generate a frmCloseEvent
when called from a modal form's event handler. It assumes that you have already handled cleaning up your form's variables since you are explicitly calling FrmReturnToForm
.
FrmSaveActiveState (stateP)
FrmRestoreActiveState
to restore the state after you remove the modal form.
void FrmSaveAllForms (void)
FrmCloseAllForms
void FrmSetActiveForm (FormType *formP)
penDownEvent
outside the form but within the display area is ignored.
winEnterEvent
for the new form immediately following the
winExitEvent
for the old form. Starting in Palm OS 3.5, FrmSetActiveForm
does not generate the winEnterEvent
. The winEnterEvent
does not occur until the newly active form is drawn.
FrmGetActiveForm
visible
attribute is set, redraw the label.
void FrmSetCategoryLabel (FormType *formP, UInt16 objIndex, Char *newLabel)
  |
-> |
Pointer to the form object ( FormType structure). |
  |
-> |
Index of an object in the form. You can obtain this by using FrmGetObjectIndex . |
  |
-> |
Pointer to the name of the new category. |
newLabel
) is saved in the object.
void FrmSetControlGroupSelection (const FormType *formP, UInt8 groupNum, UInt16 controlID)
  |
-> |
Pointer to the form object ( FormType structure). |
  |
-> |
Control group number. |
  |
-> |
ID of control to set. |
NOTE:  FrmGetControlGroupSelection
returns the selection in a control group as an object index, not as an object ID, whichFrmSetControlGroupSelection
uses to set the selection.
FrmGetControlGroupSelection
void FrmSetControlValue (const FormType *formP, UInt16 objIndex, Int16 newValue)
  |
-> |
Pointer to the form object ( FormType structure). |
  |
-> objIndex |
Index of the control in the form. You can obtain this by using FrmGetObjectIndex . |
FrmGetControlValue
void FrmSetEventHandler (FormType *formP, FormEventHandlerType *handler)
  |
-> |
Pointer to the form object ( FormType structure). |
  |
-> |
Address of the form event handler function, FormEventHandler. |
FrmDispatchEvent
calls this handler whenever it receives an event for a specific form.
FrmSetEventHandler
must be called right after a form resource is loaded. The callback routine it registers is the mechanism for dispatching events to an application. The tutorial explains how to use callback routines.
void FrmSetFocus (FormType *formP, UInt16 fieldIndex)
  |
-> |
Pointer to the form object ( FormType structure). |
  |
-> |
Index of the object to get the focus in the form. You can obtain this by using FrmGetObjectIndex . You can pass the constant noFocus so that no object has the focus. |
FldGrabFocus
internally.
data
field of the gadget object.
void FrmSetGadgetData (FormType *formP, UInt16 objIndex, const void *data)
  |
-> |
Pointer to the form object ( FormType structure). |
  |
-> |
Index of an object in the form. You can obtain this by using FrmGetObjectIndex . |
  |
-> |
Application-defined value. This value is stored into the data field of the gadget data structure ( FormGadgetType ). |
data
field of a gadget object contains a pointer to the custom object's data structure.
FrmGetGadgetData
,
FrmSetGadgetHandler
void FrmSetGadgetHandler (FormType *formP, UInt16 objIndex, FormGadgetHandlerType *attrP)
  |
-> |
Pointer to the form object ( FormType structure). |
  |
-> |
Index of a gadget object in the form. You can obtain this by using FrmGetObjectIndex . |
  |
-> |
Address of the callback function. See FormGadgetHandler . |
FrmGetGadgetData
,
FrmSetGadgetData
void FrmSetMenu (FormType *formP, UInt16 menuRscID)
  |
-> |
Pointer to the form object ( FormType structure). |
  |
-> |
Resource ID of the menu. |
void FrmSetObjectBounds (FormType *formP, UInt16 objIndex, const RectangleType *bounds)
  |
-> |
Pointer to the form object ( FormType structure). |
  |
-> |
Index of an object in the form. You can obtain this by using FrmGetObjectIndex . |
  |
-> |
Window-relative bounds. For the following objects, this sets only the position of the top-left corner: label, bitmap, and Graffiti state indicator. |
void FrmSetObjectPosition (FormType *formP, UInt16 objIndex, Coord x, Coord y)
  |
-> |
Pointer to the form object ( FormType structure). |
  |
-> |
Index of an object in the form. You can obtain this by using FrmGetObjectIndex . |
  |
-> |
Window-relative horizontal coordinate. |
  |
-> |
Window-relative vertical coordinate. |
void FrmSetTitle (FormType *formP, Char *newTitle)
  |
-> |
Pointer to the form object ( FormType structure). |
  |
-> |
Pointer to the new title string. |
newTitle
; it does not make a copy. Don't pass a pointer to a stack-based object in newTitle
.
FrmSetTitle
.
void FrmShowObject (FormType *formP, UInt16 objIndex)
  |
-> |
Pointer to the form object ( FormType structure). |
  |
-> |
Index of an object in the form. You can obtain this by using FrmGetObjectIndex . |
formGadgetDrawCmd
. See
FormGadgetHandler
.
FrmHideObject
void FrmUpdateForm (UInt16 formId, UInt16 updateCode)
  |
-> |
Resource ID of form to update. |
  |
-> |
An application-defined code that can be used to indicate what needs to be updated. Specify the code frmRedrawUpdateCode to indicate that the whole form should be redrawn. |
frmUpdateEvent
posted by this function is handled by the default form event handler, FrmHandleEvent, the updateCode
parameter is ignored. FrmHandleEvent
always redraws the form.
frmUpdateEvent
in a custom event handler, you can use the updateCode
parameter any way you want. For example, you might use it to indicate that only a certain part of the form needs to be redrawn. If you do handle the frmUpdateEvent
, be sure to return true
from your event handler so that the default form handler does not also redraw the whole form.
frmUpdateEvent
in a custom event handler, be sure to handle the case where updateCode
is set to frmRedrawUpdateCode, and redraw the whole form. This event (and code) is sent by the system when the whole form needs to be redrawn because the display needs to be refreshed.
void FrmUpdateScrollers (FormType *formP, UInt16 upIndex, UInt16 downIndex, Boolean scrollableUp, Boolean scrollableDown)
  |
-> |
Pointer to the form object ( FormType structure). |
  |
-> |
Index of the up-scroller button. You can obtain this by using FrmGetObjectIndex . |
  |
-> |
Index of the down-scroller button. You can obtain this by using FrmGetObjectIndex . |
  |
-> |
Set to true to make the up scroll arrow active (shown), or false to hide it. |
  |
-> |
Set to true to make the down scroll arrow active (shown), or false to hide it. |
true
if the specified pointer references a valid form.
Boolean FrmValidatePtr (const FormType *formP)
true
if the specified pointer is a non-NULL
pointer to an object having a valid form structure.
windowFlags.dialog
in the
WindowType
structure. This flag is true
if the window is a form.
true
if the form is visible (is drawn).
Boolean FrmVisible (const FormType *formP)
FrmCustomResponseAlert
.
Boolean FormCheckResponseFuncType (Int16 button, Char *attempt)
  |
-> |
The ID of the button that the user tapped. |
  |
-> |
The string that the user entered in the alert dialog. |
true
if the dialog should be dismissed. Return false
if the dialog should not be dismissed.
FrmCustomResponseAlert
routine:
FrmCustomResponseAlert
, this function is called with a button ID of frmResponseCreate
. This constant indicates that the dialog is about to be displayed, and your function should perform any necessary initialization. For example, on a Japanese system, a password dialog might need to disable the Japanese FEP. So it would call TsmSetFepMode(NULL, tsmFepModeOff)
in this function.attempt
string. If the string is valid input, the function should return true
. If not, it should return false
to give the user a chance to re-enter the string. FrmCustomResponseAlert
, this function is called with a button ID of frmResponseQuit
. This gives the callback a change to perform any cleanup, such as re-enabling the Japanese FEP. Boolean FormEventHandlerType (EventType *eventP)
true
if this routine handled the event, otherwise false
.
Boolean (FormGadgetHandlerType) (struct FormGadgetType *gadgetP, UInt16 cmd, void *paramP)
  |
-> |
Pointer to the gadget structure. See FormGadgetType . |
  |
-> |
A constant that specifies what action the handler should take. This can be one of the following: |
  |
|
Sent by FrmDeleteForm to indicate that the gadget is being deleted and must clean up any memory it has allocated or perform other cleanup tasks. |
  |
|
Sent by FrmDrawForm and FrmShowObject to indicate that the gadget must be drawn or redrawn. |
  |
|
Sent by FrmHandleEvent to indicate that a gadget event has been received. The paramP parameter contains the pointer to the EventType structure. |
  |
-> |
NULL except if cmd is formGadgetHandleEventCmd . In that case, this parameter holds the pointer to the EventType structure containing the event. |
true
if the event was handed successfully; false
otherwise.
formGadgetDrawCmd
, it should set the gadget's visible
attribute flag. (gadgetP->attr.visible = true
). This flag indicates that the gadget appears on the screen. If you don't set the visible
flag, the gadget won't be erased when
FrmHideObject
is called. (FrmHideObject
immediately returns if the object's visible
flag is false
.)
formGadgetEraseCmd
, it may simply choose to perform any necessary cleanup and return false
. If the function returns false
, FrmHideObject
erases the gadget's bounding rectangle. If the function returns true
, it must erase the gadget area itself.
formGadgetHandleEventCmd
, paramP
points one of two events:
frmGadgetEnterEvent
or
frmGadgetMiscEvent
. The frmGadgetEnterEvent
is passed when there is a
penDownEvent
within the gadget's bounds. This function should track the pen and perform any necessary highlighting. The frmGadgetMiscEvent
is never sent by the system. Your application may choose to use it if at any point it needs to send data to the extended gadget. In this case, the event has one or both of these fields defined: selector
, an unsigned integer, and dataP
, a pointer to data.
FrmSetGadgetHandler
  |   |