|
Slide 7.11: Line-by-line anatomy of Hello_a.c Slide 7.13: Line-by-line anatomy of Hello_a.c (cont.) Home |
|
Hello_a.c (Cont.)
if ( MenuHandleEvent( (void *) 0, &e, &err ) ) continue;
menuP: Pointer to a MenuBarType data structure
event: Pointer to an EventType structure
error: Error (or 0 if no error)
true if the event is handled; that is, if the event is a penDownEvent within the menu bar or the menu, or the event is a keyDownEvent that the menu supports.
Returns false on any other event.
case ctlSelectEvent:
if ( e.data.ctlSelect.controlID == OK )
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 ctlSelectEvent is added to the event queue; if not, a ctlExitEvent is added to the queue.
For this event, its data field contains the structure:
struct ctlSelect {
UInt16 controlID;
struct ControlType *pControl;
Boolean on;
UInt8 reserved1;
UInt16 value;
} ctlSelect;
controlID: Developer-defined ID of the control
pControl: Pointer to a control structure (ControlType)
on: true when the control is depressed; otherwise, false
reserved1: Unused
value: Current value if the control is a slider
e.data.ctlSelect.controlID .