From: d83@ath.forthnet.gr (Don Schullian)
Subject: Re: Any way to block or column select ?
On 23 Jan 1998 00:54:03 GMT, greeb@screamingmonkey.com (Jim Greeb) wrote:
>Help !!
>
> I am trying to implement a feature known as a "block" or
>"column" select. In this mode, a drag of the cursor selects across
>lines without continuing to the end of the line before moving
>down.... like this:
>
>xxx x xxxxx x xxxxxxx XXXX XXXX x xx xxx xxx xxxxx xxxxxxxx
>x xxxxxx xx xxxxxx x X XXX XXX xx xxx xxxxxxxxxx x xxxxxxx
>xx xxxxx x xxx x xx x XXX XXX X x xxxxxx x xxx x xxxxxxxxxx
>x xx x xxxxxx xx xxxx XXXXX XXX x
Sure, this doesn't sound too difficult if I understood you correctly..
You need to capture the starting X,Y postion of the cursor and let's store
them in X1 and Y1
then, keep track of the cursor's movement in a loop using X2 and Y2
If X2 or Y2 become smaller than X1 and Y1 respectivly then swap the values
When the 'release' is signaled you should have the x1,y1,x2,y2 for your block
The sub would look something like this...
SUB CaptureText ( X1%, Y1%, X2%, Y2% ) ' return values in the parameters
WhereIsCursor X1%, Y1%
X2% = X1%
Y2% = Y1%
DO
PaintBox X1%, Y1%, X2%, Y2%, HiliteAttr
WhereIsCursor X%, Y%
PaintBox X1%, Y1%, X2%, Y2%, NormAttr
X2% = X%
Y2% = Y%
IF X2% < X1% THEN SWAP X1%, X2%
IF Y2% < Y1% THEN SWAP Y1%, Y2%
LOOP UNTIL Released
END SUB
____ _ ____ ____ _____
| _ \ / \ / ___) __ | ___)(_ _)
| |_) / _ \ \____\/ \| _) | |
|____//_/ \_\(____/\__/|_| |_|
Reply to: d83@ath.forthnet.gr
www.basicguru.com/schullian
*** QwkNews (tm) v2.1
* [TN11.1] Internet Newsgroup: alt.lang.powerbasic
--- GEcho 1.20/Pro
---------------
* Origin: Toast House Remote (1:100/561)
|