MobileControlCreate Scroller?

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

MobileControlCreate Scroller?

Mark Wieder via use-livecode
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
_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: MobileControlCreate Scroller? SOLVED

Mark Wieder via use-livecode
Never mind :(  I hate when that happens :) wrong fld  name in


> On Jul 12, 2017, at 11:00 AM, JOHN PATTEN via use-livecode <[hidden email]> wrote:
>
> 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
> _______________________________________________
> use-livecode mailing list
> [hidden email]
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode


_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Loading...