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

In response to user actions, you often need to change the settings, highlight states, sizes, and locations of your controls. Whenever your application calls the TrackControl function, the Control Manager automatically manipulates control display as appropriate as the user presses and releases the mouse button. For example, TrackControl calls the HiliteControl procedure to highlight buttons; for scroll bars, TrackControl calls the DragControl procedure to move an outline of the scroll box in a scroll bar and the SetControlValue procedure to change the scroll bar's current setting and redraw the scroll box in its new location. (Note that the Dialog Manager automatically calls TrackControl for controls in alert boxes and dialog boxes. See the chapter "Dialog Manager" in this book for more information.)

When the user releases the mouse button while the cursor is in a control, your application often needs to change its setting. When the user clicks a checkbox, for example, your application must change its setting to on or off, and the Control Manager automatically draws or removes an X in the checkbox.

There are other instances when you must change the settings and display of a control. For example, when the user changes the size of a window that contains a scroll bar, you need to resize and move the scroll bar accordingly.

For controls whose values the user can set, you can use the SetControlValue procedure to change the control's setting and redraw the control accordingly. When
you need to change the maximum setting of a scroll bar or a dial, you can use the SetControlMaximum procedure; if you need to change the minimum setting, you
can use the SetControlMinimum procedure. If you need to change a control title,
you can use the SetControlTitle procedure. You can use the HideControl procedure to make a control invisible. When you need to make a control inactive
(such as when its window is not frontmost) or in any other way change the highlighting of a control, you can use the HiliteControl procedure.

To move a scroll bar, you use the MoveControl and SizeControl procedures.

Although it's not recommended, you can also change a control's default colors to those of your own choosing by using the SetControlColor procedure.

To invoke a continuous action while the user holds down the mouse button, you
can specify an action procedure (described in "Defining Your Own Action Procedures" beginning on page 5-109) in a parameter to TrackControl. Under certain circum-
stances, you can use the SetControlAction procedure to change the control's action procedure, though you should rarely if ever need to.


Subtopics
SetControlValue
SetControlMinimum
SetControlMaximum
SetControlTitle
HideControl
MoveControl
SizeControl
HiliteControl
DragControl
SetControlColor
SetControlAction

Previous Book Contents Book Index Next

© Apple Computer, Inc.
11 JUL 1996