How do I enable scrolling of a group ?
alex at tweedly.net
Sun Feb 21 08:32:49 EST 2016
Thanks to you , and Scott R.
However, I guess I need to explain myself better .... :-)
If I have a field which
- is enabled
- has a formatted size that exceeds the actual size
- has scroollbars enabled
THEN - the field will respond to the user scrolling (in this case by
using two finger touch on the trackpad of a Macbook) and swiping /
moving their fingers.
No script needed - it just responds the way a user would expect; it's
the default behaviour /operation for a field.
I would *expect* that a group which meets similar criteria would respond
similarly - i.e. without any scripting.
In the Message watcher, when positioned over a field, I see rawKeyDown,
cRevGeneral and scrollbarDrag events
But when positioned over a group - only the rawKeyDown events fire.
So - am I just over-optimistic, and it is expected that any group
scrolling is not handled by default ?
Or do I need to process rawKeyDowns (as for a mouse scroll wheel) and do
my own scrolling ?
(Hmmm - just typing this message makes me convinced the answer is that I
do my own scrolling in response to rawkeydowns. So thanks for letting me
think out loud - but do correct me if I'm wrong :-)
On 21/02/2016 03:52, [-hh] wrote:
> 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.
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
More information about the use-livecode