ON EVENTStatement
Syntax
DescriptionThis statement designates a particular function or subroutine as a system-event handling routine. A system-event handling routine is called in response to any event which the MacOS puts into the event queue designated for your program. This includes various kinds of low-level events such as mouseclicks and keypresses, as well as high-level events such as Apple Events. See the After a system event occurs, FB does not call your designated routine immediately. Instead, your program continues executing until a If there are no events in the system queue when your program executes Even if you don't designate a system-event handling routine, FB often uses system events to determine whether other kinds of interesting events have occurred. For example, if the queue contains a system event of type By designating a system-event handling routine, your program can "intercept" events like <code><b>LOCAL FN</b> DoEvent<br> evtPtr& = <b>EVENT</b><br> <b>SELECT CASE</b> evtPtr&.evtNum%<br> '[handle the event as desired in here]<br> <b>END SELECT</b><br> '"Hide" the event from further handling by FB:<br> evtPtr&.evtNum% = _nullEvt<br> <b>END FN</b></code> Another good reason to designate a system-event handling routine is so that your program can respond to high-level events such as Apple Events. See the ">"Event Manager" chapter in " Inside Macintosh Macintosh Toolbox Essentials, for a discussion of high-level events. Note: |