More scrolling queries

Graham Samuel livfoss at mac.com
Sat Dec 8 09:39:56 EST 2012


While experimenting with scrolling on iOS (as per my earlier mail), I came across something odd. Probably finger trouble on my part, but can anyone explain it?

I set up a little scrolling experiment based on the example offered in the LC Scroller Example stack. I have an iPhone screen with a kind of window in the middle, and a group "tScrollGroup" that scrolls behind ("through") the window. As usual, I make the scroll act via a scrollerDidScroll handler, so that for example when the handler fires, I use the x (horizontal) offset from the handler to set the hscroll of my group - for this experiment I'm only using horizontal scrolling. This works well, apart from some strange stuff with bouncing which isn't what this mail is about.

When I run this little example in the iOS Simulator, I can scroll my group back and forth as expected, so its location must have changed, I think: but when I query the location of the group it never changes! I do the querying within the script of the scrollerDidScroll handler. The whole handler script is:

  on scrollerDidScroll pOffsetX, pOffsetY
     lock screen
     set the hScroll of group "tScrollGroup" to pOffsetX
     unlock screen
     infoMsg "scrollerDidScroll fired with x =" && pOffsetX & "; loc of tScrollGroup is now:" && (the loc of grp "tScrollGroup")
  end scrollerDidScroll

This message arrives in the Console window as normal, with x changing values as expected, and the loc of the group always the same.

Why is this so, and what am I seeing move if it's not my group?

Puzzled

Graham

Incidentally, trying to make sense of hscroll via the IDE (i.e. not in iOS), I can't seem to make a group move by changing its hscroll. Clearly there's something I don't understand.





More information about the use-livecode mailing list