Scrolling puzzle

Graham Samuel livfoss at mac.com
Sat Nov 3 09:35:04 EDT 2012


I'm trying some scrolling experiments for an iOS app, starting with the example on the RunRev site. Based on that, I have made a stack, iPhone-4 size, and within it a rectangle in which I want my scrolling to be seen. In this experiment all the scrolling is horizontal. The (experimental) group (why does it have to be a group?) is much bigger than the rectangle it scrolls through, as you would expect. This group "tScrollGroup" is just a collection of coloured squares laid side to side and grouped

Just to give a concrete version, the rectangle through which I want the scroll to work is 56,80,248,300 - so there's a big margin on the left and right and the width is 192. The scrolled object "tScrollGroup" is 509 pixels wide.

I got the scrolling working, but the right hand end of the scrolled object goes too far to the left: I want it to stop scrolling when it reaches the right hand edge of the rectangle. So I put some stuff in my 'scrollerDidScroll' handler which tries to detect when the scroll has gone too far by comparing the 'right' of the scrolled group with the position of the right edge of the rectangle. This didn't work - and when I put some trace code in (you know, a 'put' which shows up in the console), and subsequently a field which reports the rect of "tScrollGroup", I find that the rect of this group **never changes** so the right hand side just stays at 567, which is what it was when the program started; and the location is unchanging. 

What does this mean? The scrolled object is just a group like any other isn't it? D**n it, I can see it move on the screen! Am I not really looking at the group? This is very puzzling.

Thanks for any clarification as to what is going on.

Graham






More information about the use-livecode mailing list