Page 1 of 1

orientation weirdness

Posted: Mon Jun 20, 2011 5:09 pm
by adventuresofgreg
Hello: I am experiencing some odd issues with orientation control:

I use "on orientationChanged" to reconfigure elements on my page to fit either Portrait or Landscape. It all works fine on the simulator, but on the iPhone, sometimes (this is inconsistent), when the device is in portrait orientation, my app will display as if it were landscape (with the card beelding off the right hand side of the device, and a blank space below). Then it will start 'flickering' between correct portrait orientation and the incorrect landscape orientation.

on preopencard
if the environment is "mobile" then
put "portrait,portrait upside down,landscape left,landscape right" into theallowed
iphoneSetAllowedOrientations theallowed
end if
focus on nothing
send resizestack
end preopencard

on orientationChanged
send "resizestack" to me in 0 millisecs
end orientationChanged

on resizestack
put "portrait" into currentorient
if the environment is "mobile" then
put iPhoneDeviceOrientation() into currentorient
end if
if currentorient is "portrait" or currentorient is "portrait upside down" then
--move all the stuff to portrait orientation
set the loc of group navbuttons to 326,874
set the rect of group theplotdaily to 39,533,266,821
else
--move all the stuff to landscape orientation
set the loc of group navbuttons to 504,554
set the rect of group theplotdaily to 636,176,780,466
end if

Re: orientation weirdness

Posted: Mon Jun 20, 2011 5:32 pm
by adventuresofgreg
ok - I read my post again, and realized that maybe I didn't need "on orientationchanged", so I removed it and it solved the issue.

However, when I START the iOS application, it still appears in the wrong orientation - even when I FORCE it to draw a portrait screen ie: on opencard, draw all the stuff in portrait layout). ANy idea why? Its almost as if on START, the device 'thinks' it is in landspace orientation when it is actually in Potrait. Even if I force the page to be drawn as portrait, it still ends up getting a resizestack message saying that the device is in landscape orientation.

Thanks

Re: orientation weirdness

Posted: Mon Jun 20, 2011 8:23 pm
by jacque
adventuresofgreg wrote:ok - I read my post again, and realized that maybe I didn't need "on orientationchanged", so I removed it and it solved the issue.
Right, the orientationChanged message is sent before the actual change occurs, so if you position objects in response to that message it will use the existing orientation, not the new one. The resizeStack message is sent after the device has re-oriented, and that's the one to use for new placement of objects.
However, when I START the iOS application, it still appears in the wrong orientation - even when I FORCE it to draw a portrait screen ie: on opencard, draw all the stuff in portrait layout). ANy idea why? Its almost as if on START, the device 'thinks' it is in landspace orientation when it is actually in Potrait. Even if I force the page to be drawn as portrait, it still ends up getting a resizestack message saying that the device is in landscape orientation.
The app should start up in the orientation you've set in the Standalone Settings pane using the "Initial orientation" popdown menu. Is that set to one of the portrait choices?

Re: orientation weirdness

Posted: Mon Jun 20, 2011 11:05 pm
by adventuresofgreg
YA!! Thanks. I didn't know there was initial orientation setting. It was set to Portrait, but I didn't have the other supported Interface Orientations selected - which is weird because they should have been working at all - yet they were. ??

Re: orientation weirdness

Posted: Tue Jun 21, 2011 3:07 pm
by adventuresofgreg
This is still a problem. I have the initial orientation set to Portrait, but when I launch, my first screen always shows up oriented as landscape IN a portrait orientation of the device. Any ideas?

on preopencard
if the environment is "mobile" then
put "portrait,portrait upside down,landscape left,landscape right" into theallowed
iphoneSetAllowedOrientations theallowed
end if
focus on nothing
send resizestack
end preopencard

on resizestack
put "portrait" into currentorient
if the environment is "mobile" then
put iPhoneDeviceOrientation() into currentorient
end if
if currentorient is "portrait" or currentorient is "portrait upside down" then
--move all the stuff to portrait orientation
else
--move all the stuff to landscape orientation

Re: orientation weirdness

Posted: Tue Jun 21, 2011 5:04 pm
by jacque
Move the stuff in your preopencard handler into a preOpenStack handler. You need to set orientations before anything else runs.