Legacy Documentclose button

Important: The information in this document is obsolete and should not be used for new development.

Previous Book Contents Book Index Next

Inside Macintosh: Macintosh Toolbox Essentials /
Chapter 6 - Dialog Manager / Dialog Manager Reference
Dialog Manager Routines


Handling Events in Dialog Boxes

Handling events in an alert box is very simple: after you invoke an alert box, the Dialog Manager handles most events for you by automatically calling the ModalDialog procedure. To handle events in a modal dialog box, your application must explicitly call the ModalDialog procedure after displaying the dialog box. In either case, when an enabled item is clicked, the Dialog Manager returns the item number. You'll then do whatever is appropriate in response to that click. For both alert and modal dialog boxes, you should also provide a simple event filter function that allows other windows to respond to update events and that allows your alert or dialog box to respond to a few key-down events for keys such as Return, Enter, and Esc.

You can use your normal event-handling code to determine whether an event occurs in a modeless or movable modal dialog box, or you can use the IsDialogEvent function to learn whether they need to be handled as part of a dialog box. Once you determine that an event occurs in a modeless or movable modal dialog box, you can use the DialogSelect function to handle key-down events in editable text items automatically, to handle update and activate events automatically, and to report the enabled items clicked by the user. You then respond as appropriate to clicks in your active items. Or you can use Control Manager, TextEdit, and Window Manager routines (such as FindWindow, BeginUpdate, EndUpdate, FindControl, TrackControl, and TEClick) to handle these events without the aid of the Dialog Manager.


Subtopics
ModalDialog
IsDialogEvent
DialogSelect
DrawDialog
UpdateDialog

Previous Book Contents Book Index Next

© Apple Computer, Inc.
11 JUL 1996