Previous Book Contents Book Index Next

Inside Macintosh: Files /
Chapter 3 - Standard File Package / Standard File Package Reference
Application-Defined Routines / Modal-Dialog Filter Functions


A modal-dialog filter function whose address is passed to CustomGetFile or CustomPutFile should have the following form:

FUNCTION MyModalFilterYD (theDialog: DialogPtr; 
                           VAR theEvent: EventRecord; 
                           VAR itemHit: Integer; 
                           myDataPtr: Ptr): Boolean;
A pointer to the dialog record of the dialog box.
The event record for the event.
The number of the item selected.
A pointer to the optional data whose address is passed to CustomGetFile or CustomPutFile.
Your modal-dialog filter function determines how the Dialog Manager procedure ModalDialog filters events. The ModalDialog procedure retrieves events by calling the Event Manager function GetNextEvent. The Standard File Package contains an internal filter function that performs some preliminary processing on each event it receives. If you provide a modal-dialog filter function, ModalDialog calls your filter function after it calls the internal Standard File Package filter function and before it sends the event to your dialog hook function.

Your modal-dialog filter function returns a Boolean value that reports whether it handled the event. If your function returns a value of FALSE, ModalDialog processes the event through its own filters. If your function returns a value of TRUE, ModalDialog returns with no further action.

See "Writing a Modal-Dialog Filter Function" on page 3-28 for a sample modal-dialog filter function.

Previous Book Contents Book Index Next

© Apple Computer, Inc.
2 JUL 1996