procedure Drag: opaque rectangle drag procedure DragOutline: outlined rectangle drag
link drag
August 21, 1998; Gregg M. Townsend
Requires: Version 9 graphics
This file is in the public domain.
These procedures drag rectangular objects in a window. Drag(x, y, w, h) provides an opaque move. DragOutline(x, y, w, h) drags only the outline. ____________________________________________________________ Drag(x, y, w, h) lets the user move a rectangular area using the mouse. Called when a mouse button is pressed, Drag() handles all subsequent events until a mouse button is released. As the mouse moves, the rectangular area originally at (x,y,w,h) follows it across the screen; vacated pixels at the original location are filled with the background color. The rectangle cannot be dragged off-screen or outside the clipping region. When the mouse button is released, Drag() sets &x and &y to the upper-left corner of the new location and returns. DragOutline(x, y, w, h) lets the user move a reverse-mode rectangle using the mouse. Called when a mouse button is pressed, DragOutline draws a reverse-mode rectangle inside the limits of the rectangle (x,y,w,h) and handles all subsequent events until a mouse button is released. As the mouse moves, the rectangle follows it. When the mouse button is released, the rectangle disappears, and DragOutline sets &x and &y to the upper-left corner of the new location. It is up to the calling program to update the display as necessary.