2

I'm developing a BlackBerry 10 mobile application using the Momentics IDE 2.1.2 (native SDK).

Let's start with the example of the "orientation handler" that I'm using for my layout :

            attachedObjects: [
                    OrientationHandler {
                        id: handler

                    onOrientationAboutToChange: {

                        if (orientation == UIOrientation.Landscape) {

                            mainContainer.sideMenuLarge = ui.sdu(80.0)

                            mainEntryHeaderContainer.layoutProperties.spaceQuota = 1.6
                            mainEntryBodyContainer.layoutProperties.spaceQuota = 5.8

                        } else {

                            mainContainer.sideMenuLarge = ui.sdu(60.0)

                            mainEntryHeaderContainer.layoutProperties.spaceQuota = 1
                            mainEntryBodyContainer.layoutProperties.spaceQuota = 7.4
                        }
                    }
                }
            ]

Like you see, when the app starts in portrait mode everything is cool, it should be because all the Controls Paddings and the Containers SpaceQuota things are initialized with values that it is compatible with the portrait mode, but when it starts in Landscape mode it is different thing, it will takes the initial values of the portrait mode until I switch to portrait mode and then return it to landscape mode.

How can I fix this ? And can I have 2 pages in 1 navigation pane with differents "OrientationSupport" ? I tried but it doesn't works; for example I'm in page 1 in landscape mode and then I opened the page 2 that support only the portrait mode, it switchs to portrait but when I came back to the previous page the OrientationSupport will be fixed in portrait mode (it does not handle the landscape mode anymore)

Page 1:

OrientationSupport.supportedDisplayOrientation = SupportedDisplayOrientation.All

Page 2:

OrientationSupport.supportedDisplayOrientation = SupportedDisplayOrientation.DisplayPortrait
J.M.J
  • 1,081
  • 3
  • 18
  • 35
  • No, You don't need to load separate page when orientation changed. Make your root container as Dock Layout and now place your stack layout within it and try to catch `orientationChanged()` signals for best result. – Ankur Jun 22 '15 at 14:03

0 Answers0