if ( MenuHandleEvent( (void *) 0, &e, &err ) ) continue;
The function Boolean MenuHandleEvent( MenuBarType *menuP, EventType *event, UInt16 *error ) handles events in the current menu.
This routine handles two types of events, penDownEvent and keyDownEvent.
menuP
: Pointer to a MenuBarType data structure
event
: Pointer to an EventType structure
error
: Error (or 0 if no error)
It returns 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 )
The control routine 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 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
Remember that the data field is part of the access path to an identifier in the EventType structure such as e.data.ctlSelect.controlID
.