Important: The information in this document is obsolete and should not be used for new development.
MyAction
Here's how to declare an action procedure for a control part other than an indicator if you were to name the procedureMyAction:
PROCEDURE MyAction (theControl: ControlHandle; partCode: Integer);
theControl
- A handle to the control in which the mouse-down event occurred.
partCode
- When the cursor is still in the control part where 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.DESCRIPTION
Your procedure can perform any action appropriate for the control part. For example, when a mouse-down event occurs in a scroll arrow or gray area of a scroll bar,TrackControl calls your action procedure and passes it the part code and a handle
. Your action procedure should examine the part code to determine
to the scroll bar
the part of the control in which the mouse-down event occurred. Your action
procedure should then scroll up or down a line or page as appropriate and then call
theSetControlValue
procedure to change the control's setting and redraw the
scroll box.ASSEMBLY-LANGUAGE INFORMATION
If you store a pointer to a procedure in the global variableDragHook
, your procedure is called repeatedly (with no parameters) as long as the user holds down the mouse button. TheTrackControl
function invokes the Window Manager functionDragGrayRgn
, which calls theDragHook
procedure. TheDragGrayRgn
function uses the pattern stored in the global variableDragPattern
for the dragged outline of the indicator.SEE ALSO
Listing 5-19 on page 5-53 illustrates a pair of action procedures for scrolling through a text document. As an alternative to passing a pointer to your action procedure in a parameter toTrackControl
, you can use theSetControlAction
procedure to
store a pointer to the action procedure in thecontrlAction
field in the control record. When you passPointer(-1)
instead of a procedure pointer toTrackControl
,TrackControl
uses the action procedure pointed to in the control record.