ios Scroller
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
ios Scroller
Hello,
I am having issues with scrolling a field in ios on an iPad. I am using this code example from Dixie http://forums.livecode.com/viewtopic.php?f=49&t=7991. The problem I am having is that the scroller works fine when I first go onto the card. However, when I navigate away from it and come back it will not work at all. When I move my finger to scroll, it will just highlight the options rather than scrolling. I have tried various ways to overcome the problem but nothing seems to be working. Hopefully somebody can help.
Thanks
Jmaie
I am having issues with scrolling a field in ios on an iPad. I am using this code example from Dixie http://forums.livecode.com/viewtopic.php?f=49&t=7991. The problem I am having is that the scroller works fine when I first go onto the card. However, when I navigate away from it and come back it will not work at all. When I move my finger to scroll, it will just highlight the options rather than scrolling. I have tried various ways to overcome the problem but nothing seems to be working. Hopefully somebody can help.
Thanks
Jmaie
Re: ios Scroller
Hi Jamie,
quick guess:
You do delete the native scroller when closing the card, do you?
This does not happen automatically and I don't know what happens
if there are multiple identical scrollers on the same card.
Best
Klaus
quick guess:
You do delete the native scroller when closing the card, do you?
This does not happen automatically and I don't know what happens
if there are multiple identical scrollers on the same card.
Best
Klaus
Re: ios Scroller
Hi Klaus,
Thanks for the reply. I believe so, Here is the code I am using on the card script:
Hopefully That helps a bit but I delete the scrollid on the closeCard.
Thanks
Jamie
Thanks for the reply. I believe so, Here is the code I am using on the card script:
Code: Select all
on preOpenCard
if environment() is not "mobile" then exit preOpenCard
put the rect of fld "DropBoxFileList" into fldRect
put the formattedHeight of fld "DropBoxFileList" into fldHeight
put the width of fld "DropBoxFileList" into fldWidth
set the height of fld "DropBoxFileList" to fldHeight
set the unboundedVScroll of group "raScrollingField" to true
mobileControlCreate "scroller"
put the result into scrollid
mobileControlSet scrollid, "rect", fldRect
mobileControlSet scrollid, "contentRect", (0, 0, fldWidth, fldHeight)
mobileControlSet scrollid, "visible", "true"
mobileControlSet scrollid, "canBounce", "true"
mobileControlSet scrollid, "declerationRate", "fast"
mobileControlSet scrollid, "scrollingEnabled", "true"
mobileControlSet scrollid, "canScrollToTop", "true"
mobileControlSet scrollid, "canCancelTouches", "false"
mobileControlSet scrollid, "delayTouches", "true"
mobileControlSet scrollid, "vIndicator", "true"
mobileControlSet scrollid, "indicatorStyle", "black"
mobileControlSet scrollid, "indicatorInsets", "0,0,0,0"
mobileControlSet scrollid, "hscroll", 0
mobileControlSet scrollid, "vscroll", 0
repeat with count = 1 to the number of lines of fld "DropBoxFileList"
set the textShift of line count of fld "DropBoxFileList" to - 10
end repeat
end preOpenCard
------------------------------------------------------------------------------
------------------------------------------------------------------------------
on scrollerBeginDrag
set the hilitedLine of fld "DropBoxFileList" to empty
end scrollerBeginDrag
on scrollerScrollToTop
mobileControlSet scrollId, "vscroll", 0
end scrollerScrollToTop
on scrollerDidScroll hOffset, vOffset
set the vScroll of group "raScrollingField" to vOffset
end scrollerDidScroll
------------------------------------------------------------------------------
------------------------------------------------------------------------------
on closeCard
if environment() is not "mobile" then exit closeCard
mobileControlDelete scrollid
end closeCard
Thanks
Jamie
-
- Posts: 746
- Joined: Sun Feb 04, 2007 11:01 pm
- Location: McKenna, WA
Re: ios Scroller
Do you have scrollid declared as a local variable?
local scrollid
local scrollid
Tom
MacBook Pro OS Mojave 10.14
MacBook Pro OS Mojave 10.14
Re: ios Scroller
Yes scrollerid is declared as a variable but is a global variable. I have tried as local but no change.
Jamie
Jamie
Re: ios Scroller
You need to declare your global variable everytime you use it
i don't see it declared in your code
i tested it fine
i don't see it declared in your code
i tested it fine