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 5 - Control Manager / Control Manager Reference
Control Manager Routines / Changing Control Settings and Display


SetControlColor

To draw a control using colors other than the default colors used by system software, you can use the SetControlColor procedure. The SetControlColor procedure is also available as the SetCtlColor procedure.

PROCEDURE SetControlColor (theControl: ControlHandle; 
                           newColorTable: CCTabHandle);
theControl
A handle to the control whose colors you wish to change.
newColorTable
A handle to a control color table record.
DESCRIPTION
The SetControlColor procedure changes the color table for the specified control. If the control currently has no auxiliary control record, SetControlColor creates one that includes the control color table record specified in the parameter newColorTable and adds the auxiliary control record to the head of the auxiliary control list. If there
is already an auxiliary record for the control, SetControlColor replaces its color
table with the contents of the control color table record specified in the parameter newColorTable.

To use nonstandard colors for a control, you must create a control color table, either by creating a color control table record and calling SetControlColor or by creating a control color table resource. Generally, you use SetControlColor when you create
a control using NewControl and want to use nonstandard colors for it or when you change any control's colors after you've created it. When you want to use nonstandard colors for those controls you create in a control ('CNTL') resource, you should create a control color table ('cctb') resource with the same resource ID as the control resource.

A control whose colors you set with SetControlColor should initially be invisible. After using SetControlColor to set the control's colors, use the ShowControl procedure to make the control visible.

SPECIAL CONSIDERATIONS
On color monitors, the Control Manager automatically draws controls so that they match the colors of the controls used by system software. Be aware that nonstandard colors in your controls may initially confuse your users.

When you create a control color table record, your application should not deallocate it if another control is still using it.


Previous Book Contents Book Index Next

© Apple Computer, Inc.
11 JUL 1996