Important: The information in this document is obsolete and should not be used for new development.
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 procedureSysBeep
instead of using the Dialog Manager. See Inside Macintosh: Sound for more information about theSysBeep
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.
- whether to use the Window Manager and the Control Manager instead of the Dialog Manager to create a dialog box
- whether to use the Event Manager, Window Manager, Control Manager, and TextEdit instead of the Dialog Manager to handle events
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.
- The dialog box contains more than 20 items.
- You need a multipart control, such as a scroll bar.
- You need to move items offscreen and onscreen.
- You need to display a moving indicator, such as a progress indicator.
- You need to display a list in the dialog box. (For more information on lists, see the chapter "List Manager" in Inside Macintosh: More Macintosh Toolbox.)
- You need to display text in a font other than the system font.
- Your application must respond to events other than mouse-down events, key-down events inside editable text items, and a few key-down events for keyboard equivalents when your application displays the dialog box.