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


SetControlValue

To change the current setting of a control and redraw it accordingly, you can use the SetControlValue procedure. The SetControlValue procedure is also available as the SetCtlValue procedure.

PROCEDURE SetControlValue (theControl: ControlHandle; 
                           theValue: Integer);
theControl
A handle to the control whose current setting you wish to change.
theValue
The new setting for the control.
DESCRIPTION
The SetControlValue procedure changes the contrlValue field of the control record to the specified value and redraws the control to reflect the new setting. For checkboxes and radio buttons, the value 1 fills the control with the appropriate mark, and 0 removes the mark. For scroll bars, SetControlValue redraws the scroll box where appropriate.

If the specified value is less than the minimum setting for the control, SetControlValue sets the control to its minimum setting; if the value is greater
than the maximum setting, SetControlValue sets the control to its maximum.

When you create a control, you specify an initial setting either in the control resource or in the value parameter of the NewControl function. To determine a control's current setting before changing it in response to a user's click in that control, use the GetControlValue function.

SEE ALSO
Listing 5-13 on page 5-35 illustrates the use of SetControlValue to change the setting of a checkbox. Listing 5-16 on page 5-38 and Listing 5-20 on page 5-56 illustrate the use of SetControlValue to change the setting of a scroll bar.


Previous Book Contents Book Index Next

© Apple Computer, Inc.
11 JUL 1996