Important: The information in this document is obsolete and should not be used for new development.
DragControl
If you need to draw and move an outline of a control or its indicator (such as the scroll box of a scroll bar) while the user drags it, you can use theDragControl
procedure.
PROCEDURE DragControl (theControl: ControlHandle; startPt: Point; limitRect: Rect; slopRect: Rect; axis: Integer);
theControl
- A handle to the control to drag.
startPt
- The location of the cursor, expressed in the local coordinates of the control's window, at the time the user first presses the mouse button.
limitRect
- A rectangle--which should normally coincide with or be contained in the window's content region--delimiting the area in which the user can drag the control's outline.
slopRect
- A rectangle that allows some extra space for the user to move the mouse while still constraining the control within the rectangle specified in the
limitRect
parameter.axis
- The axis along which the user may drag the control's outline. The following list shows the constants you can use--and the values they represent--for constraining the motion along an axis:
CONST noConstraint = 0; {no constraint} hAxisOnly = 1; {drag along horizontal axis only} vAxisOnly = 2; {drag along vertical axis only}DESCRIPTION
TheDragControl
procedure moves a dotted outline of the control around the screen, following the movements of the cursor until the user releases the mouse button. When the user releases the mouse button,DragControl
callsMoveControl
. In turn,MoveControl
moves the control to the location to which the user dragged it.The
TrackControl
function automatically uses theDragControl
procedure as appropriate; when you useTrackControl
, you don't need to callDragControl
.The
startPt
,limitRect
,slopRect
, andaxis
parameters have the same meaning as for the Window Manager functionDragGrayRgn
.SPECIAL CONSIDERATIONS
Before tracking the cursor,DragControl
calls the control definition function. If you define your own control definition function, you can specify custom dragging behavior.ASSEMBLY-LANGUAGE INFORMATION
LikeTrackControl
,DragControl
invokes the Window Manager functionDragGrayRgn
, so you can use the global variablesDragHook
andDragPattern
.SEE ALSO
For information about creating your own control definition functions, see "Defining Your Own Control Definition Function" beginning on page 5-102. See the description of theDragGrayRgn
function in the chapter "Window Manager" in this book for a more complete discussion of thestartPt
,limitRect
,slopRect
, andaxis
parameters, which are used identically in theDragControl
function.