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 theDragControlprocedure.
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
limitRectparameter.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
TheDragControlprocedure 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,DragControlcallsMoveControl. In turn,MoveControlmoves the control to the location to which the user dragged it.The
TrackControlfunction automatically uses theDragControlprocedure as appropriate; when you useTrackControl, you don't need to callDragControl.The
startPt,limitRect,slopRect, andaxisparameters have the same meaning as for the Window Manager functionDragGrayRgn.SPECIAL CONSIDERATIONS
Before tracking the cursor,DragControlcalls the control definition function. If you define your own control definition function, you can specify custom dragging behavior.ASSEMBLY-LANGUAGE INFORMATION
LikeTrackControl,DragControlinvokes the Window Manager functionDragGrayRgn, so you can use the global variablesDragHookandDragPattern.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 theDragGrayRgnfunction in the chapter "Window Manager" in this book for a more complete discussion of thestartPt,limitRect,slopRect, andaxisparameters, which are used identically in theDragControlfunction.