DragBox Command

Purpose

Moves a sizing rectangle around the screen.

Syntax

DragBox x1,y1,w1,h1 [,x2,y2,w2,h2], x3,y3

x1,y1,w1,h1,x2,y2,w2,h2,x3,y3: single exp

Description

DragBox creates a rectangular cut-out with the width w1 and height h1, whose upper left corner is specified with x1 and y1. This rectangle can be moved within another rectangle by holding down the left mouse button and moving the mouse. The upper left corner of the second rectangle is given in x2 and y2, the width in w2 and the height in h2. When the movement is finished, x3 and y3 contain the coordinates of the upper left corner of moved rectangle.

Example

OpenW Full 1 : Win_1.AutoRedraw = 1

Global Single x1, y1, x2, y2, w1, h1, w2, h2, x3, y3

x1 = 20

y1 = 20

w1 = 100

h1 = 100

x2 = 10

y2 = 10

w2 = _X // horizontal width in pixels

h2 = _Y // vertical height in pixels

Do

If MouseK And 1

DragBox 20, 20, 100, 100, x3, y3

// same as

// DragBox 20, 20, 100, 100, x2, y2, w2, h2, x3, y3

x1 = x3

y1 = y3

Box x1, y1, Add(x1, w1), Add(y1, h1)

Print "ok"

EndIf

Until MouseK And 2

CloseW 1

See Also

RubberBox

{Created by Sjouke Hamstra; Last updated: 28/11/2015 by James Gaite}