Important: The information in this document is obsolete and should not be used for new development.
Using the Dialog Manager
You can use the Dialog Manager to
With Dialog Manager routines, you invoke alert boxes or create dialog boxes in windows whose contents are, in turn, managed by the Dialog Manager. The Dialog Manager automatically handles update events, activate events, cursor tracking, and most text-editing tasks for your alert and dialog boxes.
- alert users to critical situations
- carry on a dialog with users when your application needs their input
To implement alerts and dialog boxes, you generally
These tasks are explained in greater detail in the rest of this chapter.
- create an alert resource or a dialog resource in a resource file
- create another resource to specify a list of items--such as controls, informative text, and pictures--to be displayed in the alert box or dialog box
- create and display the alert box or dialog box
- respond as appropriate to events relating to your alert or dialog box
- close the dialog box when you are finished with it (for alert boxes, the Dialog Manager automatically performs this for you)
Before using the Dialog Manager, you must initialize QuickDraw, the Font Manager, the Window Manager, the Menu Manager, and TextEdit, in that order. Then initialize the Dialog Manager by using the
InitDialogs
procedure.The Dialog Manager uses the system alert sound for signaling the user during various alert stages. If you want to use alert sounds other than the system alert sound, write
your own sound procedure (as illustrated in Listing 6-3 on page 6-21) and call theErrorSound
procedure to make it the current sound procedure.If you want to display static text or editable text in a font other than the system font, you can use the
SetDialogFont
procedure. However, there are a number of caveats regarding this procedure. For descriptions of these caveats, see "Special Considerations" in the description ofSetDialogFont
on page 6-105.System 7 and earlier versions of the Communications Toolbox add several new routines (namely,
AppendDITL
,ShortenDITL
, andCountDITL
) that make it easier for you
to add items to, remove items from, and count the number of items in a dialog box. Before calling these routines, you should make sure that they are available by using theGestalt
function with thegestaltDITLExtAttr
selector. Test the bit field indicated by thegestaltDITLExtPresent
constant in theresponse
parameter. If the bit is set,
thenAppendDITL
,ShortenDITL
, andCountDITL
are available.
CONST gestaltDITLExtPresent= 0; {if this bit is set, then } { AppendDITL, ShortenDITL, } { & CountDITL are available}TheGestalt
function is described in the chapter "Gestalt Manager" of Inside Macintosh: Operating System Utilities.
Subtopics
- Creating Alert Sounds and Alert Boxes
- Creating Dialog Boxes
- Providing Items for Alert and Dialog Boxes
- Manipulating Items
- Using an Application-Defined Item to Draw the Bold Outline for a Default Button
- Displaying Alert and Dialog Boxes
- Handling Events in Alert and Dialog Boxes