Scrolling a Card?

Klaus Major klaus at major-k.de
Fri Feb 20 17:17:45 EST 2004


Hi Ken,

> Howdy,
>
> I've had the scrolling working since Ken ray posted the steps.
>
> Now I want to simulate a grab (OH, do I ever wish Rev had a 'grab with
> message within rect') which scrolls the group, including the 
> scrollbars to
> follow it, of course.
>
> It's quite convoluted, because it needs to:
>
> 1) Work within scroll bounds (4 scroll coordinates).
>
> 2) Work backwards from a normal grab routine because of the way the 
> scroll
> works.
>
> 3) Switch cursors.
>
> 4) Work only while the mouse is down.
>
> Where might a set of map-grabbing routines be which might help (maps 
> are
> usually bigger than the window)?
>
> Has anyone done what I'm talking about? I've been fiddling with it for 
> hours
> and can't quite get it. Something is always wrong, either in my max/min
> routine, or the cursor offset. My pore ole brain's in a twist.
>
> Maybe there's an easier way I don't know about.

Try this in the group script.

I might cover item 2, 4 and (with two more lines in "mousedown" ;-) 3 
of your wishlist.

I am not sure if i understand item 1, but this one will get you 
started...


local darfziehen, x1, y1
## darfziehen = german for maydrag

on mousedown
   put true into darfziehen
   put the hScroll of group "xxx"  + the mouseH into x1
   put the vScroll of group "xxx" + the mouseV into y1
end mousedown

on mouseup
   put empty into darfziehen
end mouseup

on mouserelease
   mouseup
end mouserelease

on mousemove x,y
   if darfziehen = empty then exit mousemove
   set the hScroll of group "xxx" to x1 - x
   set the vScroll of group "xxx" to y1 - y
end mousemove

Hope that helps...

> TIA,
> Ken N.

Regards

Klaus Major
klaus at major-k.de
www.major-k.de



More information about the use-livecode mailing list