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 / Introduction to Alerts and Dialog Boxes


About the Dialog Manager

The Dialog Manager greatly simplifies the task of creating alert boxes and simple modal dialog boxes. Whenever you need to create an alert box, you'll save yourself much effort by relying on the Dialog Manager. (If you need only to play the system alert sound without ever displaying an alert box for an error condition, you can use the Sound Manager procedure SysBeep instead of using the Dialog Manager. See Inside Macintosh: Sound for more information about the SysBeep procedure.)

You may find, however, that the advantages of using the Dialog Manager begin to diminish for dialog boxes if you make them very complex. For complex modal dialog boxes (particularly those containing multipart controls or multiple application-defined items) and for many movable modal and modeless dialog boxes, you may find it more convenient to implement your own dialog boxes using the Window Manager to create standard windows and using the Control Manager, QuickDraw, and the Event Manager to handle the tasks assumed by the Dialog Manager.

There are two main issues to consider when deciding whether to use the Dialog Manager:

You may, for example, want to create complex dialog boxes by using the Dialog Manager, but then use the Event Manager, Window Manager, Control Manager, and TextEdit to handle events inside your normal event loop. With regard to movable modal and modeless dialog boxes, the sample code in this chapter illustrates such a hybrid approach: it uses the Dialog Manager to create the dialog boxes, but it uses normal event-handling code to determine an appropriate action according to which type of window is frontmost. When a modeless or movable modal dialog box is in front, this chapter illustrates how to take actions specific to that dialog box.

If you draw your own dialog box in a standard window without using the Dialog Manager, you won't be able to use Dialog Manager routines to help handle events,
but in return you'll be able to update the window more quickly and extend its event handling more easily. Here are some situations that tend to diminish the advantages
of using the Dialog Manager to create dialog boxes or handle events involving them:

If none of these situations applies to the dialog box you want to create, then you should definitely use the Dialog Manager. If only one situation applies, you should probably use the Dialog Manager. If two or more of these situations apply, you may find that it is better to create and manage a standard window that operates like a dialog box instead of using the Dialog Manager to create or manage it.


Previous Book Contents Book Index Next

© Apple Computer, Inc.
11 JUL 1996