Important: The information in this document is obsolete and should not be used for new development.
PATH![]() |
![]() ![]() |
This section describes the application-defined user pane functions that provide you with the ability to create a custom Appearance-compliant control without writing your own control definition function. A user pane is a general purpose stub control; it can be used as the root control for a window, as well as providing a way to hook in application-defined functions such as those described below. When Appearance is available, user panes should be used in dialog boxes instead of user items.
Once you have provided a user pane application-defined function, pass the tag constant representing the user pane function you wish to get or set in the tagName
parameter of SetControlData
. For a description of the tag constants, see Control Data Tag Constants
. For example, to set a user pane draw function, pass the constant kControlUserPaneDrawProcTag
of type ControlUserPaneDrawingUPP
in the tagName
parameter of SetControlData
.The Control Manager then draws the control using a universal procedure pointer to your user pane draw function.
The following Control Manager functions for defining your own user pane functions are new with Appearance Manager 1.0:
MyUserPaneDrawProc
draws the content of your user pane control in the rectangle of user pane control. New with Appearance Manager 1.0.MyUserPaneHitTestProc
returns the part code of the control that the point was in when the mouse-down event occurred. New with Appearance Manager 1.0.MyUserPaneTrackingProc
tracks a control while the user holds down the mouse button. New with Appearance Manager 1.0.MyUserPaneIdleProc
performs idle processing. New with Appearance Manager 1.0.MyUserPaneKeyDownProc
handles keyboard event processing. New with Appearance Manager 1.0.MyUserPaneActivateProc
handles activate and deactivate event processing. New with Appearance Manager 1.0.MyUserPaneFocusProc
handles keyboard focus. New with Appearance Manager 1.0.MyUserPaneBackgroundProc
sets the background color or pattern for user panes that support embedding. New with Appearance Manager 1.0.Draws the content of your user pane control in the rectangle of user pane control.
The Control Manager declares the type for an application-defined user pane draw function as follows:
typedef pascal void (*ControlUserPaneDrawProc)(
ControlHandle control,
SInt16 part);
The Control Manager defines the data type ControlUserPaneDrawUPP
to identify the universal procedure pointer for this application-defined function:
typedef UniversalProcPtr ControlUserPaneDrawUPP;
You typically use the NewControlUserPaneDrawProc
macro like this:
ControlUserPaneDrawUPP
myControlUserPaneDraw
UPP; myControlUserPaneDraw
UPP = NewControlUserPaneDrawProc
(MyUserPaneDraw);
You typically use the CallControlUserPaneDrawProc
macro like this:
CallControlUserPaneDrawProc
(myControlUserPaneDraw
UPP, control, part);
Here's how to declare the function MyUserPaneDrawProc
:
pascal void MyUserPaneDrawProc (
ControlHandle control,
SInt16 part);
control
part
Once you have created the function MyUserPaneDrawProc
, pass kControlUserPaneDrawProcTag
in the tagName
parameter of SetControlData
.The Control Manager will draw the user pane control with a universal procedure pointer to MyUserPaneDrawProc
.
Available with Appearance Manager 1.0 and later.
Returns the part code of the control that the point was in when the mouse-down event occurred.
The Control Manager declares the type for an application-defined user pane hit test function as follows:
typedef pascal ControlPartCode (*ControlUserPaneHitTestProc) (
ControlHandle control,
Point where);
The Control Manager defines the data type ControlUserPaneHitTestUPP
to identify the universal procedure pointer for this application-defined function:
typedef UniversalProcPtr ControlUserPaneHitTestUPP;
You typically use the NewControlUserPaneHitTestProc
macro like this:
ControlUserPaneHitTestUPP
myControlUserPaneHitTest
UPP; myControlUserPaneHitTest
UPP = NewControlUserPaneHitTest
Proc (MyUserPaneHitTest);
You typically use the CallControlUserPaneHitTestProc
macro like this:
CallControlUserPaneHitTest
Proc(myControlUserPaneHitTest
UPP, control, where);
Here's how to declare the function MyUserPaneHitTestProc
:
pascal ControlPartCode MyUserPaneHitTestProc (
ControlHandle control,
Point where);
control
where
kControlNoPart
.
Once you have created the function MyUserPaneHitTestProc
, pass kControlUserPaneHitTestProcTag
in the tagName
parameter of SetControlData
.
Available with Appearance Manager 1.0 and later.
Tracks a control while the user holds down the mouse button.
The Control Manager declares the type for an application-defined user pane tracking function as follows:
typedef pascal ControlPartCode (*ControlUserPaneTrackingProc)(
ControlHandle control,
Point startPt,
ControlActionUPP actionProc);
The Control Manager defines the data type ControlUserPaneTrackingUPP
to identify the universal procedure pointer for this application-defined function:
typedef UniversalProcPtr ControlUserPaneTrackingUPP;
You typically use the NewControlUserPaneTrackingingProc
macro like this:
ControlUserPaneTrackingUPP
myControlUserPaneTracking
UPP; myControlUserPaneTracking
UPP = NewControlUserPaneTracking
Proc (MyUserPaneTracking
);
You typically use the CallControlUserPaneTrackingingProc
macro like this:
CallControlUserPaneTracking
Proc(myControlUserPaneTracking
UPP, control, startPt, actionProc);
Here's how to declare the function MyUserPaneTrackingProc
:
pascal ControlPartCode MyUserPaneTrackingProc (
ControlHandle control,
Point startPt,
ControlActionUPP actionProc);
control
startPt
where
field of the event structure.actionProc
actionProc
parameter can be a valid procPtr
, nil
, or -1. A value of -1 indicates that the control should either perform auto tracking, or if it is incapable of doing so, do nothing (like nil
).kControlNoPartCode
is returned.
Your MyUserPaneTrackingProc
function should track the control by repeatedly calling the action function specified in the actionProc
parameter until the mouse button is released. When the mouse button is released, your function should return the part code of the control part that was tracked.
This function will only get called if you've set the kControlHandlesTracking
feature bit on creation of the user pane control. Once you have created the function MyUserPaneTrackingProc
, pass kControlUserPaneTrackingProcTag
in the tagName
parameter of SetControlData
.
Available with Appearance Manager 1.0 and later.
The Control Manager declares the type for an application-defined user pane idle function as follows:
typedef pascal void (*ControlUserPaneIdleProc)(ControlHandle control);
The Control Manager defines the data type ControlUserPaneIdleUPP
to identify the universal procedure pointer for this application-defined function:
typedef UniversalProcPtr ControlUserPaneIdleUPP;
You typically use the NewControlUserPaneIdleProc
macro like this:
ControlUserPaneIdleUPP
myControlUserPaneIdle
UPP; myControlUserPaneIdle
UPP = NewControlUserPaneIdleProc
(MyUserPaneIdle
);
You typically use the CallControlUserPaneIdleProc
macro like this:
Call
ControlUserPaneIdleProc
(myControlUserPaneIdle
UPP, control);
Here's how to declare the function MyUserPaneIdleProc
:
pascal void MyUserPaneIdleProc (ControlHandle control);
This function will only get called if you've set the kControlWantsIdle
feature bit on creation of the user pane control. Once you have created the function MyUserPaneIdleProc
, pass kControlUserPaneIdleProcTag
in the tagName
parameter of SetControlData
.
Available with Appearance Manager 1.0 and later.
Handles keyboard event processing.
The Control Manager declares the type for an application-defined user pane key down function as follows:
typedef pascalControlPartCode(*ControlUserPaneKeyDownProc)(
ControlHandle control
SInt16 keyCode,
SInt16 charCode,
SInt16 modifiers);
The Control Manager defines the data type UserPaneKeyDownUPP
to identify the universal procedure pointer for this application-defined function:
typedef UniversalProcPtr ControlUserPaneKeyDownUPP;
You typically use the NewControlUserPaneKeyDownProc
macro like this:
ControlUserPaneKeyDownUPP
myControlUserPaneKeyDown
UPP; myControlUserPaneKeyDown
UPP = NewControlUserPaneKeyDown
Proc (MyUserPaneKeyDown
);
You typically use the CallControlUserPaneKeyDownProc
macro like this:
Call
ControlUserPaneKeyDown
Proc(myControlUserPaneKeyDown
UPP, control, keyCode, charCode, modifiers);
Here's how to declare the function MyUserPaneKeyDownProc
:
pascal ControlPartCode MyUserPaneKeyDownProc (
ControlHandle control,
SInt16 keyCode,
SInt16 charCode,
SInt16 modifiers);
control
keyCode
charCode
'KCHR'
resource. modifiers
modifiers
field of the event structure specifying the state of the modifier keys and the mouse button at the time the event was posted. kControlNoPart
.
Your MyUserPaneKeyDownProc
function should handle the key pressed or released by the user and return the part code of the control where the keyboard event occurred. This function will only get called if you've set the kControlSupportsFocus
feature bit on creation of the user pane control. Once you have created the function MyUserPaneKeyDownProc
, pass kControlUserPaneKeyDownProcTag
in the tagName
parameter of SetControlData
.
Available with Appearance Manager 1.0 and later.
Handles activate and deactivate event processing.
The Control Manager declares the type for an application-defined user pane activate function as follows:
typedef pascal void (*ControlUserPaneActivateProc)(
ControlHandle control,
Boolean activating);
The Control Manager defines the data type UserPaneActivateUPP
to identify the universal procedure pointer for this application-defined function:
typedef UniversalProcPtr ControlUserPaneActivateUPP;
You typically use the NewControlUserPaneActivateProc
macro like this:
ControlUserPaneActivateUPP myControlUserPaneActivateUPP;
myControlUserPaneActivateUPP = NewControlUserPaneActivateProc
(MyUserPaneActivate);
You typically use the CallControlUserPaneActivateProc
macro like this:
CallControlUserPaneActivateProc(myControlUserPaneActivateUPP, control,
activating);
Here's how to declare the function MyUserPaneActivateProc
:
pascal void MyUserPaneActivateProc (
ControlHandle control
Boolean activating);
Your MyUserPaneActivateProc
function should perform any special processing before the user pane becomes activated or deactivated. For example, it should deactivate its TEHandle
or ListHandle
if the user pane is about to be deactivated.
This function will only get called if you've set the kControlWantsActivate
feature bit on creation of the user pane control. Once you have created the function MyUserPaneActivateProc
, pass kControlUserPaneActivateProcTag
in the tagName
parameter of SetControlData
.
Available with Appearance Manager 1.0 and later.
The Control Manager declares the type for an application-defined user pane focus function as follows:
typedef pascal ControlPartCode (*ControlUserPaneFocusProc)(
ControlHandle control,
ControlFocusPart action);
The Control Manager defines the data type ControlUserPaneFocusUPP
to identify the universal procedure pointer for this application-defined function:
typedef UniversalProcPtr ControlUserPaneFocusUPP;
You typically use the NewControlUserPaneFocusProc
macro like this:
ControlUserPaneFocusUPP myControlUserPaneFocusUPP;
myControlUserPaneFocusUPP = NewControlUserPaneFocusProc
(MyUsePaneFocus);
You typically use the CallControlUserPaneFocusProc
macro like this:
CallControlUserPaneFocusProc(myControlUserPaneFocusUPP, control, action);
Here's how to declare the function MyUserPaneFocusProc
:
pascal ControlPartCode MyUserPaneFocusProc (
ControlHandle control
ControlFocusPart action);
control
action
kControlFocusNoPart
is returned if the user pane has lost the focus or cannot be focused.
Your MyUserPaneFocusProc
function is called in response to a change in keyboard focus. It should respond by changing keyboard focus based on the part code passed in the action
parameter.
This function will only get called if you've set the kControlSupportsFocus
feature bit on creation of the user pane control. Once you have created the function MyUserPaneFocusProc
, pass kControlUserPaneFocusProcTag
in the tagName
parameter of SetControlData
.
Available with Appearance Manager 1.0 and later.
Sets the background color or pattern for user panes that support embedding.
The Control Manager declares the type for an application-defined user pane background color function as follows:
typedef pascal (*ControlUserPaneBackgroundProcPtr)(
ControlHandle control,
ControlBackgroundPtr info);
The Control Manager defines the data type ControlUserPaneBackgroundUPP
to identify the universal procedure pointer for this application-defined function:
typedef UniversalProcPtr ControlUserPaneBackgroundUPP;
You typically use the NewControlUserPaneBackgroundProc
macro like this:
ControlUserPaneBackgroundUPP myControlUserPaneBackgroundUPP;
myControlUserPaneBackgroundUPP = NewControlUserPaneBackgroundProc
(MyUsePaneBackground);
You typically use the CallControlUserPaneBackgroundProc
macro like this:
CallControlUserPaneBackgroundProc(myControlUserPaneBackgroundUPP, control,
info);
Here's how to declare the function MyUserPaneBackgroundProc
:
pascal void MyUserPaneBackgroundProc (
ControlHandle control
ControlBackgroundPtr info);
Your MyUserPaneBackgroundProc
function should set the user pane background color or pattern to whatever is appropriate given the bit depth and device type passed in. Your MyUserPaneBackgroundProc
function is called to set up the background color. This ensures that when an embedded control calls EraseRgn
or EraseRect
, the background is erased to the correct color or pattern.
This function will only get called if there is a control embedded in the user pane and if you've set the kControlHasSpecialBackground
and kControlSupportsEmbedding
feature bits on creation of the user pane control. Once you have created the function MyUserPaneBackgroundProc
, pass kControlUserPaneBackgroundProcTag
in the tagName
parameter of SetControlData
.