Important: The information in this document is obsolete and should not be used for new development.
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 theTrackControlfunction, the Control Manager automatically manipulates control display as appropriate as the user presses and releases the mouse button. For example,TrackControlcalls theHiliteControlprocedure to highlight buttons; for scroll bars,TrackControlcalls theDragControlprocedure to move an outline of the scroll box in a scroll bar and theSetControlValueprocedure to change the scroll bar's current setting and redraw the scroll box in its new location. (Note that the Dialog Manager automatically callsTrackControlfor 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
SetControlValueprocedure 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 theSetControlMaximumprocedure; if you need to change the minimum setting, you
can use theSetControlMinimumprocedure. If you need to change a control title,
you can use theSetControlTitleprocedure. You can use theHideControlprocedure 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 theHiliteControlprocedure.To move a scroll bar, you use the
MoveControlandSizeControlprocedures.Although it's not recommended, you can also change a control's default colors to those of your own choosing by using the
SetControlColorprocedure.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 toTrackControl. Under certain circum-
stances, you can use theSetControlActionprocedure 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