Scott,
I had two scrollers that were made by the functions "createChScroller" and "createPPScroller". Their ID's were stored in two local variables, scrollidCh and scrollidPP.
Here's all of the important code that I had in my card
Code: Select all
local scrollidCh
local scrollidPP
on preOpenCard
createChScroller //Create the two scrollers
createPPScroller
end preOpenCard
on closeCard
if environment() is not "mobile" then exit closeCard
set the vScroll of group "scrollGroupChart" to 0
set the vScroll of group "scrollGroupPorP" to 0
iphoneControlDelete scrollidCh
iphoneControlDelete scrollidPP
end closeCard
Code: Select all
on scrollerBeginDrag
put empty
end scrollerBeginDrag
on scrollerScrollToTop
iphoneControlSet scrollidCh, "vscroll", 0
iphoneControlSet scrollidPP, "vscroll", 0
end scrollerScrollToTop
on scrollerDidScroll hOffset, vOffset
put iphoneControlTarget() into tID
--Check what control sent the scroll message. Only update that control!
if tID=scrollid then
set the vScroll of group "scrollGroup" to vOffset
else if tID=scrollidCh then
set the vScroll of group "scrollGroupChart" to vOffset
else if tID=scrollidPP then
set the vScroll of group "scrollGroupPorP" to vOffset
end if
end scrollerDidScroll
And then I also had code to destroy/recreate the scroller on the fly. This was called during run-time in order to create/destroy the controls whenever the user came to the card. I was using the scroller to overlay a list field in order for user to select items from a list: I wanted to prep the selections for the user, so that's what the "refresh" functions do.
Also, the two fields that I wanted to scroll on are called "FieldChart" and "FieldPorP"
Code: Select all
on createChScroller
if environment() is not "mobile" then exit createChScroller
put the formattedHeight of fld "FieldChart" into fldHeight
put the width of fld "FieldChart" into fldWidth
set the height of fld "FieldChart" to fldHeight
set the top of field "FieldChart" to the top of group "scrollGroupChart"
set the unboundedVScroll of group "scrollGroupChart" to true
set the vScroll of group "scrollGroupChart" to 0
iphoneControlCreate "scroller"
put the result into scrollidCh
iphoneControlSet scrollidCh, "rect", the rect of group "scrollGroupChart"
iphoneControlSet scrollidCh, "contentRect", (0, 0, fldWidth, fldHeight)
iphoneControlSet scrollidCh, "visible", true
iphoneControlSet scrollidCh, "canBounce", true
iphoneControlSet scrollidCh, "declerationRate", fast
iphoneControlSet scrollidCh, "scrollingEnabled", true
iphoneControlSet scrollidCh, "canScrollToTop",true
iphoneControlSet scrollidCh, "canCancelTouches",true
iphoneControlSet scrollidCh, "delayTouches", true
iphoneControlSet scrollidCh, "vIndicator", true
iphoneControlSet scrollidCh, "indicatorStyle", black
iphoneControlSet scrollidCh, "indicatorInsets", "0,0,0,0"
iphoneControlSet scrollidCh, "hscroll", 0
iphoneControlSet scrollidCh, "vscroll", 0
repeat with count = 1 to the number of lines of fld "FieldChart"
set the textShift of line count of fld "FieldChart" to 0
end repeat
end createChScroller
on refreshCh
//This is used to repaint the scroller selector
wait for .01 sec
set the hilitedlines of fld "FieldChart" to the hilitedlines of fld "FieldChart"
end refreshCh
on destroyChScroller
if environment() is not "mobile" then exit destroyChScroller
set the vScroll of group "scrollGroupChart" to 0
iphoneControlDelete scrollidCh
end destroyChScroller
on createPPScroller
if environment() is not "mobile" then exit createPPScroller
put the formattedHeight of fld "FieldPorP" into fldHeight
put the width of fld "FieldPorP" into fldWidth
set the height of fld "FieldPorP" to fldHeight
set the top of field "FieldPorP" to the top of group "scrollGroupPorP"
set the unboundedVScroll of group "scrollGroupPorP" to true
set the vScroll of group "scrollGroupPorP" to 0
iphoneControlCreate "scroller"
put the result into scrollidPP
iphoneControlSet scrollidPP, "rect", the rect of group "scrollGroupPorP"
iphoneControlSet scrollidPP, "contentRect", (0, 0, fldWidth, fldHeight)
iphoneControlSet scrollidPP, "visible", true
iphoneControlSet scrollidPP, "canBounce", true
iphoneControlSet scrollidPP, "declerationRate", fast
iphoneControlSet scrollidPP, "scrollingEnabled", true
iphoneControlSet scrollidPP, "canScrollToTop",true
iphoneControlSet scrollidPP, "canCancelTouches",true
iphoneControlSet scrollidPP, "delayTouches", true
iphoneControlSet scrollidPP, "vIndicator", true
iphoneControlSet scrollidPP, "indicatorStyle", black
iphoneControlSet scrollidPP, "indicatorInsets", "0,0,0,0"
iphoneControlSet scrollidPP, "hscroll", 0
iphoneControlSet scrollidPP, "vscroll", 0
repeat with count = 1 to the number of lines of fld "FieldPorP"
set the textShift of line count of fld "FieldPorP" to 0
end repeat
end createPPScroller
on refreshPP
//This is used to repaint the scroller selector
wait for .01 sec
set the hilitedlines of fld "FieldPorP" to the hilitedlines of fld "FieldPorP"
end refreshPP
on destroyPPScroller
if environment() is not "mobile" then exit destroyPPScroller
set the vScroll of group "scrollGroupPorP" to 0
iphoneControlDelete scrollidPP
end destroyPPScroller
Is that what you're looking for? Hope this helps.
Jacob