Event.h
, SysEvent.h
, and INetMgr.h
) that the system passes to the application when the user interacts with the graphical user interface. Chapter 4, "Event Loop" in the Palm OS Programmer's Companion discusses in detail how this works. This chapter provides reference-style information about each event. First it shows the types used by Palm OS events. Then it discusses the following events in alphabetical order:
Event | UI Object |
---|---|
appStopEvent
| N.A. |
ctlEnterEvent, ctlExitEvent, ctlRepeatEvent, ctlSelectEvent
| Control |
daySelectEvent
| N.A. |
fldChangedEvent, fldEnterEvent, fldHeightChangedEvent
| Field |
frmCloseEvent, frmGotoEvent, frmLoadEvent, frmOpenEvent, frmSaveEvent, frmUpdateEvent, frmTitleEnterEvent, frmTitleSelectEvent
| Form |
frmGadgetEnterEvent, frmGadgetMiscEvent | Extended gadget |
inetSockReadyEvent, inetSockStatusChangeEvent
| N.A. (INetLib) |
keyDownEvent
| N.A. |
lstEnterEvent, lstExitEvent, lstSelectEvent
| List |
menuEvent , menuOpenEvent , menuCloseEvent , menuCmdBarOpenEvent
| Menu |
nilEvent
| N.A. |
penDownEvent, penMoveEvent, penUpEvent
| N.A. (pen) |
popSelectEvent
| Popup (Control) |
sclEnterEvent, sclRepeatEvent, sclExitEvent
| Scroll bar |
tblEnterEvent, tblExitEvent, tblSelectEvent
| Table |
winEnterEvent, winExitEvent
| Window |
eventsEnum
enum specifies the possible event types.
enum events {
    nilEvent = 0,
    penDownEvent,
    penUpEvent,
    penMoveEvent,
    keyDownEvent,
    winEnterEvent,
    winExitEvent,
    ctlEnterEvent,
    ctlExitEvent,
    ctlSelectEvent,
    ctlRepeatEvent,
    lstEnterEvent,
    lstSelectEvent,
    lstExitEvent,
    popSelectEvent,
    fldEnterEvent,
    fldHeightChangedEvent,
    fldChangedEvent,
    tblEnterEvent,
    tblSelectEvent,
    daySelectEvent,
    menuEvent,
    appStopEvent = 22,
    frmLoadEvent,
    frmOpenEvent,
    frmGotoEvent,
    frmUpdateEvent,
    frmSaveEvent,
    frmCloseEvent,
    frmTitleEnterEvent,
    frmTitleSelectEvent,
    tblExitEvent,
    sclEnterEvent,
    sclExitEvent,
    sclRepeatEvent,
    tsmFepModeEvent,
   
    menuCmdBarOpenEvent = 0x0800,
    menuOpenEvent,
    menuCloseEvent,
    frmGadgetEnterEvent,
    frmGadgetMiscEvent,
    firstINetLibEvent = 0x1000,
    firstWebLibEvent = 0x1100,
   
    firstUserEvent = 0x6000
} eventsEnum;
EventType
structure contains all the data associated with a system event. All event types have some common data. Most events also have data specific to those events. The specific data uses a union that is part of the EventType
data structure. The union can have up to 8 words of specific data.
typedef struct {
    eventsEnum eType;
    Boolean penDown;
    UInt8 tapCount;
    Int16 screenX;
    Int16 screenY;
    union{
    ...
    } data;
} EventType;
eType
|
One of the eventsEnum constants. Specifies the type of the event.
|
penDown
|
true if the pen was down at the time of the event, otherwise false .
|
tapCount
| The number of taps received at this location. This value is used mainly by fields. When the user taps in a text field, two taps selects a word, and three taps selects the entire line. |
screenX
| Window-relative position of the pen in pixels (number of pixels from the left bound of the window). |
screenY
| Window-relative position of the pen in pixels (number of pixels from the top left of the window). |
data
|
The specific data for an event, if any. The data is a union, and its exact contents depend on the eType field. The Event Reference section in this chapter shows what the data field contains for each event.
|
NOTE:  Remember that thedata
field is part of the access path to an identifier in theEventType
structure. As an example, the code to access thecontrolID
field of actlEnterEvent
would be:EventType *event;
//...
if (event->data.ctlEnter.controlID ==
MyAppLockButton)
tapCount
field is only defined if 3.5 New Feature Set is present. Because of the tapCount
field, it's particularly important that you clear the event structure before you use it to add a new event to the queue in Palm OS 3.5 and higher. Otherwise, the tapCount
value may be incorrect for the new event.
EventPtr
defines a pointer to an
EventType
.
typedef EventType *EventPtr;
CtlHandleEvent
sends this event when it receives a
penDownEvent
within the bounds of a control.
data
field contains the following structure:
struct ctlEnter {
    UInt16 controlID;
    struct ControlType *pControl;
} ctlEnter;
controlID
| Developer-defined ID of the control. |
pControl
|
Pointer to a control structure ( ControlType ).
|
CtlHandleEvent
sends this event. When CtlHandleEvent
receives a
ctlEnterEvent
, it tracks the pen until the pen is lifted from the display. If the pen is lifted within the bounds of a control, a
ctlSelectEvent
is added to the event queue; if not, a ctlExitEvent
is added to the event queue.
CtlHandleEvent
sends this event. When CtlHandleEvent
receives a
ctlEnterEvent
in a repeating button (tREP) or a feedback slider control (tslf), it sends a ctlRepeatEvent. When CtlHandleEvent
receives a ctlRepeatEvent in a repeating button, it sends another ctlRepeatEvent if the pen remains down within the bounds of the control for 1/2 second beyond the last ctlRepeatEvent.
CtlHandleEvent
receives a ctlRepeatEvent
in a feedback slider control, it sends a ctlRepeatEvent
each time the slider's thumb moves by at least one pixel. Feedback sliders do not send ctlRepeatEvents
at regular intervals like repeating buttons do.
true
in response to a ctlRepeatEvent
, it stops the ctlRepeatEvent
loop. No further ctlRepeatEvents
are sent.
data
field contains the following structure:
struct ctlRepeat {
    UInt16 controlID;
    struct ControlType *pControl;
    UInt32 time;
    UInt16 value;
} ctlRepeat;
value
field is only present if 3.5 New Feature Set is present.
CtlHandleEvent
sends this event. When CtlHandleEvent
receives a
ctlEnterEvent
, it tracks the pen until the pen is lifted. If the pen is lifted within the bounds of the same control it went down in, a cltSelectEvent
is added to the event queue; if not, a
ctlExitEvent
is added to the event queue.
data
field contains the following structure:
struct ctlSelect {
    UInt16 controlID;
    struct ControlType *pControl;
    Boolean on;
    UInt8 reserved1;
    UInt16 value;
} ctlSelect;
value
field is only present if 3.5 New Feature Set is present.
data
field contains the following structure:
struct daySelect {
    struct DaySelectorType *pSelector;
    Int16 selection;
    Boolean useThisDate;
    UInt8 reserved1;
} daySelect;
pSelector
| Pointer to a day selector structure (DaySelectorType). |
selection
| Not used. |
useThisDate
|
Set to true to automatically use the selected date.
|
reserved1
| Unused. |
FldHandleEvent
sends this event when the text of a field has been scrolled as a result of drag-selecting. When FldHandleEvent
receives a
fldEnterEvent
, it positions the insertion point and tracks the pen until it's lifted. Text is selected (highlighted) appropriately as the pen is dragged.
data
field contains the following structure:
struct fldChanged {
    UInt16 fieldID;
    struct FieldType *pField;
} fldChanged;
FldHandleEvent
sends this event when the field receives a
penDownEvent
within the bounds of a field. For this event, the data
field contains the following structure:
struct fldEnter {
    UInt16 fieldID;
    struct FieldType *pField;
} fldEnter;
FldHandleEvent
sends this event. The field API supports a feature that allows a field to dynamically resize its visible height as text is added or removed from it. Functions in the field API send a fldHeightChangedEvent to change the height of a field.
fldHeightChangedEvent
. If the field is directly on a form, your application code should handle the fldHeightChangedEvent
itself. The form code does not handle the event for you.
data
field contains the following structure:
struct fldHeightChanged {
    UInt16 fieldID;
    struct FieldType *pField;
    Int16 newHeight;
    UInt16 currentPos;
} fldHeightChanged;
FrmGotoForm
and
FrmCloseAllForms
send this event. FrmGotoForm
sends a frmCloseEvent to the currently active form; FrmCloseAllForms
sends a frmCloseEvent to all forms an application has loaded into memory. If an application doesn't intercept this event, the routine
FrmHandleEvent
erases the specified form and releases any memory allocated for it.
data
field contains the following structure:
struct frmClose {
    UInt16 formID;
} frmClose;
FrmHandleEvent
sends this event when there is a
penDownEvent
within the bounds of an extended gadget. The gadget handler function (see
FormGadgetHandler
) should handle this event.
data
field contains the following structure:
struct gadgetEnter {
    UInt16 gadgetID;
    struct FormGadgetType *gadgetP;
} gadgetEnter;
gadgetID
| Developer-defined ID of the gadget. |
gadgetP
|
Pointer to the FormGadgetType object representing this gadget.
|
FrmHandleEvent
function passes frmGadgetMiscEvents
on to the extended gadget's handler function (see
FormGadgetHandler
).
data
field contains the following structure:
struct gadgetMisc {
    UInt16 gadgetID;
    struct FormGadgetType *gadgetP;
    UInt16 selector;
    void *dataP;
} gadgetMisc;
sysAppLaunchCmdGoto
launch code. sysAppLaunchCmdGoto
is generated when the user selects a record in the global find facility. Like
frmOpenEvent
, frmGotoEvent
is a request that the application initialize and draw a form, but this event provides extra information so that the application may display and highlight the matching string in the form.
data
field contains the following structure:
struct frmGoto {
    UInt16 formID;
    UInt16 recordNum;
    UInt16 matchPos;
    UInt16 matchLen;
    UInt16 matchFieldNum;
    UInt32 matchCustom;
} frmGoto;
FrmGotoForm
and
FrmPopupForm
send this event. It's a request that the application load a form into memory.
data
field contains the following structure:
struct frmLoad {
    UInt16 formID;
} frmLoad;
FrmGotoForm
and
FrmPopupForm
send this event. It is a request that the application initialize and draw a form.
data
field contains the following structure:
struct frmOpen {
    UInt16 formID;
} frmOpen;
FrmSaveAllForms
sends this event. It is a request that the application save any data stored in a form.
FrmHandleEvent
sends this event when it receives a
penDownEvent
within the bounds of the title of the form. Note that only the written title, not the whole title bar is active.
data
field contains the following structure:
struct frmTitleEnter {
    UInt16 formID;
    } frmTitleEnter;
FrmHandleEvent
sends this event.
FrmHandleEvent
receives a
frmTitleEnterEvent
, it tracks the pen until the pen is lifted. If the pen is lifted within the bounds of the active same title bar region, a frmTitleSelectEvent
is added to the event queue.
data
field contains the following structure:
struct frmTitleSelect {
    UInt16 formID;
} frmTitleSelect;
FrmHandleEvent
responds to frmTitleSelectEvent
. Its response is to enqueue a
keyDownEvent
with a vchrMenu
character to display the form's menu.
FrmUpdateForm
, or in some cases the routine
FrmEraseForm
, sends this event when it needs to redraw the region obscured by the form being erased.
frmUpdateEvent
to the event queue. The form receives the event and redraws the region using the updateCode
value.
updateCode
and then use this event to also trigger behavior in another form, usually when changes made to one form need to be reflected in another form.
data
field contains the following structure:
struct frmUpdate {
    UInt16 formID;
    UInt16 updateCode;
} frmUpdate;
INetLibGetEvent
(not EvtGetEvent
) when the Internet library determines that a socket has data ready for an
INetLibSockRead
.
data
field contains the following structure:
struct {
    MemHandle sockH;
    UInt32 context;
    Boolean inputReady;
    Boolean outputReady;
} inetSockReady;
sockH
| Socket handle of the socket that this event refers to. |
context
| Not used. |
inputReady
|
true when the socket has data ready for the INetLibSockRead call.
|
outputReady
| Not used. |
penDown
, tapCount
, screenX
and screenY
fields are not valid for Internet library events and should be ignored.
INetLibGetEvent
(not EvtGetEvent
) when the Internet library determines that a socket has data ready for an
INetLibSockRead
.
data
field contains the following structure:
struct {
    MemHandle sockH;
    UInt32 context;
    UInt16 status;
    Err sockErr;
}inetSockStatusChange;
penDown
, tapCount
, screenX
and screenY
fields are not valid for Internet library events and should be ignored.
data
field contains the following structure:
struct _KeyDownEventType {
    WChar chr;
    UInt16 keyCode;
    UInt16 modifiers;
};
LstHandleEvent
sends this event when it receives a
penDownEvent
within the bounds of a list object.
data
field contains the following structure:
struct lstEnter {
    UInt16 listID;
    struct ListType *pList;
    Int16 selection;
} lstEnter;
listID
| Developer-defined ID of the list. |
pList
|
Pointer to a list structure ( ListType ).
|
selection
| Unused. |
LstHandleEvent
sends this event. When LstHandleEvent
receives a
lstEnterEvent
, it tracks the pen until the pen is lifted. If the pen is lifted within the bounds of a list, a
lstSelectEvent
is added to the event queue; if not, a lstExitEvent is added to the event queue.
data
field contains the following structure:
struct lstExit {
    UInt16 listID;
    struct ListType *pList;
} lstExit;
LstHandleEvent
sends this event. When LstHandleEvent
receives a
lstEnterEvent
, it tracks the pen until the pen is lifted. If the pen is lifted within the bounds of a list, a lstSelectEvent is added to the event queue; if not, a
lstExitEvent
is added to the event queue.
data
field contains the following structure:
struct lstSelect {
    UInt16 listID;
    struct ListType *pList;
    Int16 selection;
} lstSelect;
listID
| Developer-defined ID of the list. |
pList
|
Pointer to a list structure ( ListType ).
|
selection
| Item number (zero-based) of the new selection. |
MenuHandleEvent
sends this event when the user enters the menu shortcut keystroke, causing the command toolbar to be displayed at the bottom of the screen. Applications might respond to this event by calling
MenuCmdBarAddButton
to add custom buttons to the command toolbar. Shared libraries or other non-application code resources can add buttons to the toolbar by registering to receive the sysNotifyMenuCmdBarOpenEvent
notification. (See Chapter 36, "Notification Manager.")
data
field contains the following structure:
struct menuCmdBarOpen {
    Boolean preventFieldButtons;
    UInt8 reserved;
} menuCmdBarOpen;
preventFieldButtons
|
If true , the field manager does not add the standard cut, copy, paste, and undo buttons when the focus is on a field. If false , the field adds the buttons.
|
reserved
| Unused. |
true
. Returning true
prevents the form manager from displaying the toolbar.
MenuHandleEvent
sends this event:
menuEvent
. data
field contains the following structure:
struct menu {
    UInt16 itemID;
} menu;
MenuHandleEvent
sends this event when a new active menu has been initialized. A menu becomes active the first time the user taps the Menu silk-screen button or taps the form's titlebar, and it might need to be re-initialized and reactivated several times during the life of an application.
FrmSetMenu
call changes the active menu on the form. menuOpenEvent
is sent again.
MenuAddItem
,
MenuHideItem
, or
MenuShowItem
.
menuCloseEvent
is defined by the system, but it is not currently sent. If you need to perform some cleanup (such as closing a resource) after the menu item you added is no longer needed, do so in response to
frmCloseEvent
.
data
field contains the following structure:
struct menuOpen {
    UInt16 menuRscID;
    Int16 cause;
} menuOpen;
EvtGetEvent
is passed a time-out value (a value other than evtWaitForever, -1). If EvtGetEvent
is unable to return an event in the specified time, it returns a nilEvent. Different Palm OS versions and different devices can send nilEvent
s under different circumstances, so you might receive a nilEvent
even before the timeout has expired.
data
field contains the following structure:
struct _PenUpEventType {
    PointType start;
    PointType end;
};
FrmHandleEvent
sends this event when the user selects an item in a popup list.
data
field contains the following structure:
struct popSelect {
    UInt16 controlID;
    struct ControlType *controlP;
    UInt16 listID;
    struct ListType *listP;
    Int16 selection;
    Int16 priorSelection;
} popSelect;
SclHandleEvent
sends this event when it receives a penDownEvent
within the bounds of a scroll bar.
data
field contains the following structure:
struct sclEnter {
    UInt16 scrollBarID;
    struct ScrollBarType *pScrollBar;
} sclEnter;
scrollBarID
| Developer-defined ID of the scroll bar resource. |
pScrollBar
| Pointer to the scroll bar structure. |
SclHandleEvent
sends this event when the user lifts the pen from the scroll bar.
value
and newvalue
.
sclRepeatEvents
. If, however, the application has implemented dynamic scrolling, it doesn't have to catch this event.
data
field contains the following structure:
struct sclExit {
    UInt16 scrollBarID;
    struct ScrollBarType *pScrollBar;
    Int16 value;
    Int16 newValue;
} sclExit;
SclHandleEvent
sends this event when the pen is continually held within the bounds of a scroll bar.
data
field contains the following structure:
struct sclRepeat {
    UInt16 scrollBarID;
    struct ScrollBarType *pScrollBar;
    Int16 value;
    Int16 newValue;
    Int32 time;
} sclRepeat;
TblHandleEvent
sends this event when it receives a
penDownEvent
within the bounds of an active item in a table object.
data
field contains the following structure:
struct tblEnter {
    UInt16 tableID;
    struct TableType *pTable;
    Int16 row;
    Int16 column;
} tblEnter;
tableID
| Developer-defined ID of the table. |
pTable
|
Pointer to a table structure ( TableType ).
|
row
| Row of the item. |
column
| Column of the item. |
TblHandleEvent
sends this event. When TblHandleEvent
receives a
tblEnterEvent
, it tracks the pen until it's lifted from the display. If the pen is lifted within the bounds of the same item it went down in, a
tblSelectEvent
is added to the event queue; if not, a tblExitEvent is added to the event queue.
data
field contains the following structure:
struct tblExit {
    UInt16 tableID;
    struct TableType *pTable;
    Int16 row;
    Int16 column;
} tblExit;
tableID
| Developer-defined ID of the table. |
pTable
|
Pointer to a table structure ( TableType ).
|
row
| Row of the item. |
column
| Column of the item. |
TblHandleEvent
sends this event. When TblHandleEvent
receives a
tblEnterEvent
, it tracks the pen until the pen is lifted from the display. If the pen is lifted within the bounds of the same item it went down in, a tblSelectEvent is added to the event queue; if not, a
tblExitEvent
is added to the event queue.
data
field contains the following structure:
struct tblSelect {
    UInt16 tableID;
    struct TableType *pTable;
    Int16 row;
    Int16 column;
} tblSelect;
tableID
| Developer-defined ID of the table. |
pTable
|
Pointer to a table structure ( TableType ).
|
row
| Row of the item. |
column
| Column of the item. |
WinSetActiveWindow
is issued (
FrmSetActiveForm
calls this routine), or the user taps within the bounds of a window that is visible but not active. All forms are windows, but not all windows are forms; for example, the menu bar is a window but not a form.
data
field contains the following structure:
struct _WinEnterEventType {
    WinHandle enterWindow;
    WinHandle exitWindow;
};
winEnterEvent
).
data
field contains the following structure:
struct _WinExitEventType {
    WinHandle enterWindow;
    WinHandle exitWindow;
};
  |   |