How do I enable scrolling of a group ?
-hh
hh at livecode.org
Sat Feb 20 22:52:39 EST 2016
This is essentially the same technique that Scott R. suggested.
New is the MOVE-TO-SCROLL-FACTOR, in case you prefer that.
** The scroll respects here the group's relative to card's size. **
** Thus scrolling becomes "parallel" to the mouseMove distances. **
For example if you move your fingers/the mouse from (20,70) to (50,30)
then the hscroll of the the group changes by +30
and the vscroll of the the group changes by -40.
Of course you may moreover scale these factors (fw0, fh0 below) to
your needs, for example to an increase for a large display.
-- In group's script.
-- Here given for hscroll and vscroll, mostly I use only one of both.
-- Also I give it for mouseMove, you change this to your need
-- (touchMove ...) better than I do.
local d0=false, x0=0, y0=0, h0=0, w0=0, fh0=1, fw0=1
on mouseEnter; put false into d0; end mouseEnter
on mouseUp; put false into d0; end mouseUp
on mouseRelease; put false into d0; end mouseRelease
on mouseMove x,y
if not d0 then exit mouseMove
set hscroll of me to w0+fw0*(x-x0)
set vscroll of me to h0+fh0*(y-y0)
end mouseMove
on mouseDown
put (the height of this card) div (the height of me) into fh0
put (the width of this card) div (the width of me) into fw0
put true into d0; put the clickV into y0; put the clickH into x0
put the vscroll of me into h0 ; put the hscroll of me into w0
end mouseDown
I also have sometimes, in order to have a 'static' scrollbar size,
a transparent (for example by using ink 'noop") object, may also be
disabled, of card's (half) size in the group.
More information about the use-livecode
mailing list