Important: The information in this document is obsolete and should not be used for new development.
PATH![]() |
![]() ![]() |
The following Control Manager functions for creating and removing controls are new, changed, or not recommended with Appearance Manager 1.0:
GetNewControl
creates a control from a control resource. Changed with Appearance Manager 1.0.NewControl
creates a control based on parameter data. Changed with Appearance Manager 1.0.DisposeControl
removes a control and any of its embedded controls from a window. Changed with Appearance Manager 1.0.KillControls
removes all controls in a specified window. Changed with Appearance Manager 1.0.Creates a control from a control resource .
pascal ControlHandle GetNewControl (
SInt16 resourceID,
WindowPtr owningWindow);
resourceID
owningWindow
GetNewControl
can't read the control resource from the resource file, it returns nil
.
The GetNewControl
function creates a control structure from the information in the specified control resource, adds the control structure to the control list for the specified window, and returns as its function result a handle to the control. You use this handle when referring to the control in most other Control Manager functions. After making a copy of the control resource, GetNewControl
releases the memory occupied by the original control resource before returning.
The control resource specifies the rectangle for the control, its initial setting, its visibility state, its maximum and minimum settings, its control definition ID, a reference value, and its title (if any). After you use GetNewControl
to create the control, you can change the control characteristics with other Control Manager functions.
If the control resource specifies that the control should be visible, the Control Manager draws the control. If the control resource specifies that the control should initially be invisible, you can use the
function
ShowControl
to make the control visible.
When an embedding hierarchy is established within a window, GetNewControl
automatically embeds the newly created control in the root control of the owning window. See
If you are using standard system controls, default colors are used and the control color table resource is ignored. To use colors other than the default colors, you must write your own custom control definition function.
Creates a control based on parameter data.
pascal ControlHandle NewControl (
WindowPtr owningWindow,
const Rect *boundsRect,
ConstStr255Param controlTitle,
Boolean initiallyVisible,
SInt16 initialValue,
SInt16 minimumValue,
SInt16 maximumValue,
SInt16 procID,
SInt32 controlReference);
owningWindow
boundsRect
controlTitle
initiallyVisible
true
in this parameter, NewControl
draws the control immediately, without using your window's standard updating mechanism. If you pass false
, you must later use ShowControl
to display the control.initialValue
minimumValue
maximumValue
procID
controlReference
NewControl
runs out of memory or fails, it returns nil
.
The NewControl
function creates a control structure from the information you specify in its parameters, adds the control structure to the control list for the specified window, and returns as its function result a handle to the control. You can use this handle when referring to the control in most other Control Manager functions. Generally, you should use the function GetNewControl
instead of NewControl
, because GetNewControl
is a resource-based control-creation function that allows you to localize your application without recompiling.
When an embedding hierarchy is established within a window, NewControl
automatically embeds the newly created control in the root control of the owning window. see Embedding Controls
.
If you are using standard system controls, default colors are used and the control color table resource is ignored. To use colors other than the default colors, write your own custom control definition function.
Removes a control and any of its embedded controls from a window.
pascal void DisposeControl (ControlHandle theControl);
The DisposeControl
function removes the specified control (and any embedded controls it may possess) from the screen, deletes it from the window's control list, and releases the memory occupied by the control structure and any data structures associated with the control. Passing the root control to this function is the effectively the same as calling KillControls
. If an embedding hierarchy is present, DisposeControl
disposes of the controls embedded within a control before disposing of the container control.
You should use DisposeControl
when you wish to retain the window but dispose of one of its controls. The Window Manager functions CloseWindow
and DisposeWindow
automatically dispose of all controls associated with the given window.
KillControlsRemoves all controls in a specified window.
pascal void KillControls (WindowPtr theWindow);
The KillControls
function disposes of all controls associated with the specified window. To remove just one control, use DisposeControl
. If an embedding hierarchy is present, KillControls
disposes of the controls embedded within a control before disposing of the container control.
You should use KillControls
when you wish to retain the window but dispose of its controls. The Window Manager functions CloseWindow
and DisposeWindow
automatically dispose of all controls associated with the given window.