1. #1
    Sencha User
    Join Date
    Aug 2013
    Posts
    32
    Vote Rating
    1
    kenyee is on a distinguished road

      0  

    Default Unanswered: orientation change and different resolutions?

    Unanswered: orientation change and different resolutions?


    Wondering what fellow BB10 developers are doing for this?
    I asked on the Sencha Architect 2.x forum and the suggestion was to use various CardLayout containers for different device resolutions:
    http://www.sencha.com/forum/showthre...-Architect-2.x

    But the onLaunch event in the Application object doesn't let you control what layout is launched because that's autogenerated by Architect.

    e.g., the application launch event handler looks like this:
    Code:
        launch: function() {
            // this is where you should sense the device resolution and choose the appropriate CardLayout container
            // but then you can't control what's put into the Ext.create event below
    
            Ext.Viewport.on([
            {
                event: 'orientationchange',
                fn: 'onViewportOrientationChange',
                scope: this
            }
            ]);
            Ext.create('myapp.mycardlayout', {fullscreen: true});
        }
    So if in the launch code, you want to do something like
    if device.width > 600 then
    set layout = cardLayoutHires
    else
    set layout = cardLayoutLowres
    You can't change what is used by Ext.create as the view layout name.

    Once you use the proper cardlayout container, you can do

    Ext.getCmp(layout).getLayout().setActiveItem('card1Portrait');

  2. #2
    Sencha User NaveenanM's Avatar
    Join Date
    Oct 2012
    Posts
    79
    Answers
    12
    Vote Rating
    1
    NaveenanM is on a distinguished road

      0  

    Default


    Hi There,

    Here is another suggestion. You can use the deviceorientation API as well. The API is documented here, http://developer.blackberry.com/html5/apis/blackberry.sensors.html#.event:deviceorientation

    T
    hanks

    Naveen M
    Naveenan Murugesu
    BlackBerry Application Development Consultant
    nmurugesu@rim.com
    https://developer.blackberry.com/

  3. #3
    Sencha User
    Join Date
    Aug 2013
    Posts
    32
    Vote Rating
    1
    kenyee is on a distinguished road

      0  

    Default


    Thanks, Naveen. That's a good way to check for initial orientation.

    But the essential problem is
    - in the code that Sencha Architect generates, there's no way to programmatically choose an initial layout
    - there's no way to switch layouts in the code that Sencha Architect generates

Thread Participants: 1