Resizing NavBar using resizeControl
Posted: Tue Jun 24, 2014 10:25 pm
Hello,
I need to build a custom navBar for an iPhone app that will resize and move the items in the group automatically when the card orientation changes. Everything works fine except for the placement of the right hand button. The right button is located properly for portrait initially and moves correctly for landscape left and landscape right. The problem is when the orientation is changed from landscape to portrait. The right button and the end of the group are off the screen to the right. I'm running on the sim. Any help would be appreciated.
Tom
I need to build a custom navBar for an iPhone app that will resize and move the items in the group automatically when the card orientation changes. Everything works fine except for the placement of the right hand button. The right button is located properly for portrait initially and moves correctly for landscape left and landscape right. The problem is when the orientation is changed from landscape to portrait. The right button and the end of the group are off the screen to the right. I'm running on the sim. Any help would be appreciated.
Tom
Code: Select all
## Group Script
on resizeControl
## I'm checking to see if the resizeColtrol is sent to the grp
answer "Resized"
## setting the position of the grp
set the topleft of me to 0,20
## Sizing the graphic to the size of the grp
set the rect of graphic "NavBar" of me to the rect of me
## Locating the left and right btns
set the left of btn "Left" to the left of me + 12
set the right of btn "Right" of me to the right of me - 12
## setting the position of the fld to the center of the grp
set the loc of fld "navBar" of me to the loc of me
end resizeControl
Code: Select all
## Card Script
on orientationChanged
put mobileDeviceOrientation() into theOrientation
if theOrientation contains "portrait" then
answer theOrientation
set the width of group "NavBar" to the height of this cd
## Reposition other elements on the card
else
if theOrientation contains "landscape left" then
answer theOrientation
set the width of group "NavBar" to the height of this cd
## Reposition other elements on the card
else
if theOrientation contains "landscape right" then
answer theOrientation
set the width of group "NavBar" to the height of this cd
## Reposition other elements on the card
end if
end if
end if
end orientationChanged
Code: Select all
## Stack Script
on openStack
if the environment is "mobile" then
## Portrait , Portrait Upside Down , Landscape Left, Landscape Right
put "portrait,landscape left,landscape right" into theallowed
iphoneSetAllowedOrientations theallowed
set the bottomleft of group "ToolBar" of cd "Home" to 0, the height of this stack
end if
end openStack