Multiple iOS scrollers scroll add the same time. How do I prevent this?

William de Smet williamdesmet at gmail.com
Sat Aug 18 10:16:04 EDT 2012


Hi there,

I have two iOS scrollers in my app on the same card.
They almost work fine. They do scroll and show content but two
scrollers scroll at the same time.
What do I have to do to prevent this?
Do I add the same code (different id) to scrollToTop and scrollerDidScroll

This my code:
on preOpencard
 iphoneControlCreate "scroller"
      put the result into scrollid2
      iphoneControlSet scrollid2, "rect", the rect of group "scrollGroup2"
      iphoneControlSet scrollid2, "contentRect", (0, 0, fldWidth, fldHeight)
      iphoneControlSet scrollid2, "visible", "true"
      iphoneControlSet scrollid2, "canBounce", "true"
      iphoneControlSet scrollid2, "declerationRate", "fast"
      iphoneControlSet scrollid2, "scrollingEnabled", "true"
      iphoneControlSet scrollid2, "canScrollToTop", "true"
      iphoneControlSet scrollid2, "canCancelTouches", "true"
      iphoneControlSet scrollid2, "delayTouches", "true"
      iphoneControlSet scrollid2, "vIndicator", "true"
      iphoneControlSet scrollid2, "indicatorStyle", "black"
      iphoneControlSet scrollid2, "indicatorInsets",  "0,0,0,0"
      iphoneControlSet scrollid2, "hscroll", 0
      iphoneControlSet scrollid2, "vscroll", 0

 iphoneControlCreate "scroller"
      put the result into scrollid3
      iphoneControlSet scrollid3, "rect", the rect of group "scrollGroup3"
      iphoneControlSet scrollid3, "contentRect", (0, 0, fldWidth, fldHeight)
      iphoneControlSet scrollid3, "visible", "true"
      iphoneControlSet scrollid3, "canBounce", "true"
      iphoneControlSet scrollid3, "declerationRate", "fast"
      iphoneControlSet scrollid3, "scrollingEnabled", "true"
      iphoneControlSet scrollid3, "canScrollToTop", "true"
      iphoneControlSet scrollid3, "canCancelTouches", "true"
      iphoneControlSet scrollid3, "delayTouches", "true"
      iphoneControlSet scrollid3, "vIndicator", "true"
      iphoneControlSet scrollid3, "indicatorStyle", "black"
      iphoneControlSet scrollid3, "indicatorInsets",  "0,0,0,0"
      iphoneControlSet scrollid3, "hscroll", 0
      iphoneControlSet scrollid3, "vscroll", 0
end preOpencard


on scrollerBeginDrag
   set the hilitedLine of fld 1 to empty
end scrollerBeginDrag

on scrollerScrollToTop
      iphoneControlSet scrollId2, "vscroll", 0
  ---- iphoneControlSet scrollId3, "vscroll", 0  ???????
end scrollerScrollToTop


on scrollerDidScroll hOffset, vOffset
    set the vScroll of group "scrollGroup2" to vOffset
   --- set the vScroll of group "scrollGroup3" to vOffset ????
end scrollerDidScroll

greetings,

William




More information about the use-livecode mailing list