I received code from Dave Kilroy that actually works. But I have not idea why it works. It seems counter intuitive.
On the card script, he added some variables for iPhone
Code: Select all
on preopencard
resizeStack
end preopencard
on resizestack
dispatch "autopositionMe" to grp "mygroup"
if isMobile() then createScroller
end resizestack
on createScroller
if "adminScroller" is among the lines of mobileControls() then mobileControlDelete "adminScroller"
--
put the rect of grp "mygroup" into tScrollerRect
put the formattedrect of grp "mygroup" into tContentRect
set the unboundedVScroll of grp "mygroup" to true
--
mobileControlCreate "scroller", "adminScroller"
put the result into tScrollID
--
mobileControlSet tScrollID, "rect", tScrollerRect
mobileControlSet tScrollID, "contentRect", tContentRect
mobileControlSet tScrollID, "visible", "true"
mobileControlSet tScrollID, "vIndicator", "true"
mobileControlSet tScrollID, "vscroll", 0
mobileControlSet tScrollID, "hscroll", 0
if platform() = "iphone" then
mobileControlSet tScrollID, "canBounce", "true"
mobileControlSet tScrollID, "canScrollToTop", "true"
mobileControlSet tScrollID, "canCancelTouches", "true"
mobileControlSet tScrollID, "delayTouches", "true"
mobileControlSet tScrollID, "pagingEnabled", "false"
mobileControlSet tScrollID, "decelerationRate", "fast"
mobileControlSet tScrollID, "indicatorStyle", "black"
mobileControlSet tScrollID, "scrollingEnabled", "true"
mobileControlSet tScrollID, "lockDirection", "true"
end if
end createScroller
on scrollerDidScroll hOffset, vOffset
set the vscroll of group "mygroup" to vOffset
set the hscroll of group "mygroup" to 0
end scrollerDidScroll
on closecard
if isMobile() then
if "adminScroller" is among the lines of mobileControls() then mobileControlDelete "adminScroller"
end if
end closecard
but those variables weren't enough to fix the problem. He also moved the positioning from the card script and resize into the script for the group. This is where my confusion comes. He LOCKS the group and then resizes it..... I thought you UNLOCKED the group, resized it and then LOCKED it again.
Code: Select all
on autoPositionMe
set the lockLoc of me to true
put the width of this stack into tStackWidth
put the height of this stack into tStackHeight
put max((tStackHeight * 0.02),20) into tVerticalSpace
put the loc of the current card into tLoc
put tStackWidth * 0.80 into tButtonWidth
put tStackWidth * 0.10 into tButtonLeft
put 10 into tButtonPadding
--
set the top of button "return" to 170
set the left of button "return" to (tStackWidth * 0.05)
--
repeat with i = 1 to 10
set the width of btn ("button" & i) to tButtonWidth
set the loc of btn ("button" & i) to tLoc
if i = 1 then put (the bottom of btn "return" + tVerticalSpace) into tButtonTop
else put (the bottom of btn ("button" & (i - 1)) + tVerticalSpace) into tButtonTop
set the top of btn ("button" & i) to tButtonTop
put the bottom of btn ("button" & i) into tButtonBottom
end repeat
--
set the rect of grc "grcBase" of me to ((the left of btn "button1") - tButtonPadding), \
((the top of btn "button1") - tButtonPadding), \
((the right of btn "button1") + tButtonPadding), \
(tButtonBottom + tButtonPadding)
--
set the rect of me to ((the left of btn "button1") - tButtonPadding), \
((the top of btn "button1") - tButtonPadding), \
((the right of btn "button1") + tButtonPadding), \
(tStackHeight - tButtonPadding)
--
set the vscroll of me to 0
end autoPositionMe
This is in the stack script
Code: Select all
on preopenstack
if isMobile() then
--answer "mobile"
put "portrait,portrait upside down,landscape left,landscape right" into theallowed
-- Function Call
mobileSetAllowedOrientations theallowed
end if
end preopenstack
function isMobile
return the environment is "mobile"
end isMobile
So can anyone explain lockloc - and why this version works in IOS...and the my version doesn't(in IOS)? I'd ask Dave...but he's traveling for a few days...and I am just confused.