Important: The information in this document is obsolete and should not be used for new development.
The Dialog Color Table Resource
On color monitors, the Dialog Manager automatically adds color to your alert and dialog boxes so that they match the colors of the windows, alert boxes, and dialog boxes used by system software. These colors provide aesthetic consistency across all monitors, from black-and-white displays to 8-bit color displays. On a color monitor, for example, the racing stripes in the title bar of a modeless dialog box are gray, the close box and window frame are in color, and the buttons and text are black.When you create dialog resources, your application's dialog boxes use the system's default colors. Typically, this is all you need to do to provide color for your dialog boxes--with the following exceptions:
"Using an Application-Defined Item to Draw the Bold Outline for a Default Button" beginning on page 6-56 explains how to create a draw routine that outlines the default button of a dialog box. If you deactivate a dialog box, you should dim its buttons and use gray to draw the outline for the default button. Because
- When you need to include a color version of an icon in a dialog box, you must create a resource of type
'cicn'
with the same resource ID as the black-and-white'ICON'
resource specified in the item list resource. Plate 2 at the front of this book shows an alert box that includes a color icon.- When you need to produce a blended gray color for outlining the inactive (that is, dimmed) default button, you must create a dialog color table (
'dctb'
) resource with the same resource ID as the dialog resource.
GetNewDialog
andNewDialog
supply black-and-white graphics ports for dialog boxes, you can create a dialog color table resource for the dialog box to force the Dialog Manager to supply a color graphics port. Then you can use a blended gray color for the outline for the default button. (TheNewColorDialog
function supplies a color graphics port.)Even when you create a dialog color table resource for drawing a gray outline, you should not change the system's default colors. If you feel absolutely compelled to use nonstandard colors, you can use the Dialog Manager to specify colors other than the default colors. Your application can specify its own colors for a dialog box by creating a dialog color table (
'dctb'
) resource with the same resource ID as the dialog resource (described beginning on page 6-141). You don't have to call any new routines to change the colors used in dialog boxes. When you call theGetNewDialog
function, for example, the Dialog Manager automatically attempts to load a dialog color table resource with the same resource ID as the dialog resource.Be aware, however, that nonstandard colors in your dialog boxes may initially confuse your users. Also be aware that despite any changes you may make, users can alter the colors of dialog boxes anyway by changing settings in the Color control panel.
A dialog color table resource has exactly the same format as a window color table (that is, a resource of type
- WARNING
- Because the behavior of color alert and dialog boxes, color items, and color icons is unreliable on computers using system software versions earlier than System 7, do not create these color elements if you wish to maintain backward compatibility.
'wctb'), which is described in the chapter "Window Manager" of this book.
If the dialog box's content color isn't white, specify the
invisible
constant in the dialog resource. Use the Window Manager procedureShowWindow
to display the dialog box when it's the frontmost window. If the dialog box is a modeless dialog box that is not in front, use the Window Manager procedureShowHide
to display it.