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
Resources


The Item Color Table Resource

On color monitors, the Dialog Manager automatically draws the items in your dialog and alert boxes so that they match the colors of the items used by system software in its dialog and alert boxes. The Dialog Manager also uses the default system font when it draws the text in the static text and editable text items of your dialog and alert boxes.

If you feel absolutely compelled to use nonstandard fonts and colors, you can use the Dialog Manager to specify your own colors, typeface, font style, and font size.

Note
The Dialog Manager displays the typeface, font style, and font size you specify only on color monitors.
Your application can specify these by creating an item color table ('ictb') resource with the same resource ID as the dialog or alert box's item list resource , and then providing a dialog color table resource for a dialog box or an alert color table resource for an alert box. You don't have to call any new routines to change the colors, typefaces, font styles, or font sizes used in dialog boxes. When you call the GetNewDialog function, for example, the Dialog Manager automatically attempts to load an item color table resource with the same resource ID as the item list resource.

Note
To make it easier to localize your application for other script
systems, you should not change the font. Do not use a smaller font,
such as 9-point Geneva; some script systems, such as KanjiTalk,
require 12-point fonts.
Also, be aware that nonstandard colors for items in your dialog and alert boxes may initially confuse your users.

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.
If you want to provide an item color table resource for an alert box or a dialog box, you must create an alert color table resource or a dialog color table resource, even if the item color table resource has no actual color information and describes only static text and editable text style changes.

An item color table resource is a resource of type 'ictb'. All item color table resources must have resource ID numbers greater than 128.

There is no Rez template available for creating item color table resources. When
you compile an item color table resource, it should follow the format illustrated in
Figure 6-49.

Figure 6-49 Structure of a compiled item color table resource

You define an item color table resource for a dialog box or an alert box by specifying these elements in a resource with the 'ictb' resource type:

The information contained in an element depends on the type of item it describes:

When both the item data and item offset elements are set to 0, then the control or text item is drawn with the default colors, typeface, font size, and font style. Even if only the first few items of the dialog box have color style information, there must be room for all of the items actually in the box (with the item data and item offset elements of the unused entries set to 0).

For controls, the colors are described by a color table identical to a 'cctb' resource used by the Control Manager. Multiple controls can use the same color table. If the resource sets both the item data and the item offset element to 0, then the system's default colors are used for the control. The format of a control color table is illustrated in Figure 6-50.

Figure 6-50 Structure of a compiled control color table

A control color table consists of the following elements:

Figure 6-51 shows the format of a text style table.

Figure 6-51 Structure of a compiled text style table

The text style table must be 20 bytes long, as shown in Figure 6-51. Multiple editable text and static text items can use the same text style record. To display text in the standard typeface, color, font size, and font style, set the item data and item offset elements for the item to 0. Allocate space for all fields in the text style table, even if they are not used.

A text style table consists of the following elements (see Inside Macintosh: Text for a discussion of font families, font style, and point sizes):


Previous Book Contents Book Index Next

© Apple Computer, Inc.
11 JUL 1996