MobileControlCreate Scroller?

JOHN PATTEN johnpatten at me.com
Wed Jul 12 20:00:01 CEST 2017


Hi All,

I have a group that consists of a couple of buttons and a field. The field can contain text that fits nicely with it, and at times, text that is outside the bounds of the field. This app is targeted for an iPhone. I wanted to create a mobile scroller to allow the user to scroll the field when the text is longer than the field.

I am using the tutorial online (http://lessons.livecode.com/m/4069/l/94412-creating-a-native-scroller-to-scroll-a-field <http://lessons.livecode.com/m/4069/l/94412-creating-a-native-scroller-to-scroll-a-field>) and this scrip. I have placed the script in the stack as the group containing the field is a background and appears on every card.

On cards where the text extends beyond the field, the mobile scroller appears, however when I scroll the field in the iPhone, the text does not move and I don’t see the text below the boundary of the field.

What am i doing incorrect?


local sScrollerID

on preOpenCard

local tScrollerRect,tContentRect

if environment() is not "mobile" then exit preOpenCard

mobileControlCreate "scroller", "loremScroll"

put the result into sScrollerID

put the rect of fld "FieldNotes" of group id 1012 into tScrollerRect

--put the rect of group id 1012 into tScrollerRect

put the topleft of fld "FieldNotes" of group id 1012 & "," & the right of fld "FieldNotes" of group id 1012 &","&( the top of fld "FieldNotes" of group id 1012 + the formattedHeight of fld "FieldNotes" of group id 1012) into tContentRect

mobileControlSet "loremScroll", "rect", tScrollerRect

mobileControlSet "loremScroll", "contentRect", tContentRect

mobileControlSet "loremScroll", "visible", true

mobileControlSet "loremScroll", "scrollingEnabled", true

mobileControlSet "loremScroll", "vIndicator", true

mobileControlSet "loremScroll", "vscroll", 0

mobileControlSet "loremScroll", "canBounce", true

end preOpenCard


on scrollerDidScroll hOffset, vOffset

// When the user scrolls move the displayed content

set the vScroll of fld "scrollMe" to vOffset

--set the vScroll of group id 1012 to vOffset

end scrollerDidScroll



Thank you!
John Patten
SUSD


More information about the use-livecode mailing list