Legacy Documentclose button

Important: The information in this document is obsolete and should not be used for new development.

PATHDocumentation > Mac OS 8 and 9 > Human Interface Toolbox > Control Manager >

Mac OS 8 Control Manager Reference


Defining Your Own Action Functions

When your action function is called for a control part, your action function is passed a handle to the control and the control's part code. Your action function should then respond as is appropriate. For an example of such an action function, see MyActionProc . The only exception to this is for indicators that don't support live feedback.

If the mouse-down event occurs in an indicator of a control that does not support live feedback, your action function should take no parameters, because the user may move the cursor outside the indicator while dragging it. For an example of such an action function, see MyIndicatorActionProc .

The following Control Manager functions for defining your own control action functions are new, changed, or not recommended with Appearance Manager 1.0:


MyActionProc

Defines actions t o be performed repeatedly in response to a mouse-down event in a control part.

The Control Manager declares the type for an application-defined action function as follows:

typedef pascal void (*ControlActionProcPtr)(
                     ControlHandle theControl,
                     ControlPartCode partCode);

The Control Manager defines the data type ControlActionUPP to identify the universal procedure pointer for this application-defined function:

typedef UniversalProcPtr ControlActionUPP;

You typically use the NewControlActionProc macro like this:

ControlActionUPP myActionUPP; myActionUPP = NewControlActionProc(MyAction);

You typically use the CallControlActionProc macro like this:

CallControlActionProc(MyActionUPP, theControl, partCode);

Here's how to declare an action function for a control part if you were to name the function MyActionProc:

pascal void MyActionProc (
                     ControlHandle theControl,
                     ControlPartCode partCode);
theControl
A handle to the control in which the mouse-down event occurred.
partCode
A control part code; see Control Part Code Constants . When the cursor is still in the control part where the mouse-down event first occurred, this parameter contains that control's part code. When the user drags the cursor outside the original control part, this parameter contains 0.

DISCUSSION

When a mouse-down event occurs in a control, HandleControlClick and TrackControl respond as is appropriate by highlighting the control or dragging the indicator as long as the user holds down the mouse button. You can define other actions to be performed repeatedly during this interval. To do so, define your own action function and point to it in the actionProc parameter of the TrackControl function or the inAction parameter of HandleControlClick. This is the only way to specify actions in response to all mouse-down events in a control or indicator.

IMPORTANT

You should use the MyIndicatorActionProc function while tracking indicators of controls that don't support live feedback.


VERSION NOTES

Changed with Appearance Manager 1.0 to support live feedback.


SEE ALSO

SetControlAction .


MyIndicatorActionProc

Defines actions to be performed while the user holds down the mouse button when the cursor is over a control's indicator.

When the Appearance Manager is available, you should use MyActionProc to define actions to be performed in response to a mouse-down event in an indicator of a control that supports live feedback. You should only use MyIndicatorActionProc if the control does not support live feedback.


VERSION NOTES

Not recommended with Appearance Manager 1.0 and later.


\xA9 1998 Apple Computer, Inc. – (Last Updated 19 Nov 98)