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 theTrackControl
function, the Control Manager automatically manipulates control display as appropriate as the user presses and releases the mouse button. For example,TrackControl
calls theHiliteControl
procedure to highlight buttons; for scroll bars,TrackControl
calls theDragControl
procedure to move an outline of the scroll box in a scroll bar and theSetControlValue
procedure to change the scroll bar's current setting and redraw the scroll box in its new location. (Note that the Dialog Manager automatically callsTrackControl
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 theSetControlMaximum
procedure; if you need to change the minimum setting, you
can use theSetControlMinimum
procedure. If you need to change a control title,
you can use theSetControlTitle
procedure. You can use theHideControl
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 theHiliteControl
procedure.To move a scroll bar, you use the
MoveControl
andSizeControl
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 toTrackControl
. Under certain circum-
stances, you can use theSetControlAction
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