use bottomRight of scroll fld to resize
HyperChris at aol.com
HyperChris at aol.com
Fri Sep 17 17:57:03 EDT 2004
Hello all,
I like these horizontal AND vertical scroll fields but curiously they have
this little square in the lower right corner that does nothing. I needed a user
resizable scroll field for my project so I used mouseMove to make that little
corner into a grab point . Here is the card script to make any field, with
both H and V scrollbars, use that corner as a grabpoint ...
on mouseMove pNewMouseH,pNewMouseV
global gClickOffsetH,gCickOffsetV,gClickFieldNum
if the mouse is up then
put "" into gClickOffsetH
put "" into gCickOffsetV
put 0 into gClickFieldNum
else if gClickOffsetH is empty then
put theGrabTarget(pNewMouseH,pNewMouseV) into gClickFieldNum
if gClickFieldNum=0 then exit mouseMove
put the right of fld gClickFieldNum - pNewMouseH into gClickOffsetH
put the bottom of fld gClickFieldNum - pNewMouseV into gCickOffsetV
else
get pNewMouseH+gClickOffsetH &comma& pNewMouseV+gCickOffsetV
if the optionKey is down
then set the bottomRight of fld gClickFieldNum to it
else set the rect of fld gClickFieldNum to \
(the topLeft of fld gClickFieldNum &comma& it)
end if
end mouseMove
function theGrabTarget pNewMouseH,pNewMouseV
repeat with x=1 to number of fields
if not (the hScrollBar of fld x and the vScrollBar of fld x)
then next repeat
put the scrollBarWidth of fld x into tGrabSize
get (the right of fld x - tGrabSize) &comma& \
(the bottom of fld x - tGrabSize) &comma& bottomRight of fld x
if (pNewMouseH &comma& pNewMouseV) is within it then return x
end repeat
return 0
end theGrabTarget
... and you can type this in your msg box to see an example ...
go stack URL "http://www.christophercomputers.com/rev/testDragger.rev"
If you like 'grabbin and draggin' then this is a good intro to using
mouseMove. Feel free to weigh in with suggestions as there are always better ways !
Christopher
More information about the use-livecode
mailing list