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
Resources


The Control Resource

You can use a control resource to define a control. A control resource is a resource of
type 'CNTL'. All control resources must have resource ID numbers greater than 128.
Use the GetNewControl function (described on page 5-74) to create a control defined in a control resource. The Control Manager uses the information you specify to create a control record in memory. (The control record is described on page 5-66.)

This section describes the structure of this resource after it is compiled by the Rez resource compiler, available from APDA. The format of a Rez input file for a control resource differs from its compiled output form, which is illustrated in Figure 5-25. If you are concerned only with creating a control resource, see "Creating and Displaying a Control" beginning on page 5-13.

Figure 5-25 Structure of a compiled control ('CNTL') resource

The compiled version of a control resource contains the following elements:

   CONST popupTitleBold       = $00000100;   {boldface font style}
         popupTitleItalic     = $00000200;   {italic font style}
         popupTitleUnderline  = $00000400;   {underline font }
                                             { style}
         popupTitleOutline    = $00000800;   {outline font style}
         popupTitleShadow     = $00001000;   {shadow font style}
         popupTitleCondense   = $00002000;   {condensed text}
         popupTitleExtend     = $00004000;   {extended text}
         popupTitleNoStyle    = $00008000;   {monostyle text}
         popupTitleLeftJust   = $00000000;   {place title left }
                                             { of pop-up box}
         popupTitleCenterJust = $00000001;   {center title over }
                                             { pop-up box}
         popupTitleRightJust  = $000000FF;   {place title right }
                                             { of pop-up box}
   CONST
      pushButProc          = 0;     {button}
      checkBoxProc         = 1;     {checkbox}
      radioButProc         = 2;     {radio button}
      useWFont             = 8;     {when added to above, shows }
                                    { title in the window font}
      scrollBarProc        = 16;    {scroll bar}
      popupMenuProc        = 1008;  {pop-up menu}
      popupFixedWidth      = $0001; {add to popupMenuProc to }
                                    { use fixed-width control}
      popupUseAddResMenu   = $0004; {add to popupMenuProc to }
                                    { specify a value of type }
                                    { ResType in the contrlRfCon }
                                    { field of the control }
                                    { record; Menu Manager }
                                    { adds resources of this }
                                    { type to the menu}
      popupUseWFont        = $0008; {if added to popupMenuProc, }
                                    { shows title in window font}
Note
The title of a button, checkbox, radio button, or pop-up menu normally appears in the system font, which in Roman script systems is 12-point Chicago. Do not use a smaller font; some script systems, such as KanjiTalk, require 12-point fonts. You should generally use the system font in your controls; doing so will simplify localization effort. However, if you absolutely need to display a control title in the font currently associated with the window's graphics port, you can add the popupUseWFont constant to the pop-up menu control definition
ID or add the useWFont constant to the other standard control
definition IDs.
After you use GetNewControl to create the control, you can change the current setting, the maximum setting, the minimum setting, the reference value, and the title by using, respectively, the SetControlValue, SetControlMaximum, SetControlMinimum, SetControlReference, and SetControlTitle routines. You can use the MoveControl and SizeControl procedures to change the control's rectangle. You
can use the GetControlValue, GetControlMaximum, GetControlMinimum, GetControlReference, and GetControlTitle routines to determine the
control values.


Previous Book Contents Book Index Next

© Apple Computer, Inc.
11 JUL 1996