1. #1
    Sencha User
    Join Date
    Mar 2012
    Location
    UK
    Posts
    28
    Answers
    1
    Vote Rating
    0
    BoroChris is on a distinguished road

      0  

    Default Answered: Can't get simple 4box layout working with flex

    Answered: Can't get simple 4box layout working with flex


    I am trying to do a simple 4 box layout (i.e. have a screen divided into 4 panels which will each have different content.
    If I use fixed height/width for each hbox/vbox then it works fine however if I try to use flex then I just get everything squashed into a few pixels in the middle of the screen. I have tried using %ge height/width but these also do not seem to work. I need to use flex so that it will work on differnet device formats.

    This is the code as is but I have tried every combination that I can think of
    Code:
    STmenu7=new Ext.Panel(
        {cardpanel:"MainCardPanel",id:"MenuPnl",layout:"fit",transition:"pop",items:[
        {align:"stretch",flex:1,id:"mp1",layout:"vbox",xtype:"panel",items:[
            {align:"stretch",flex:1,id:"mp2",layout:"hbox",xtype:"panel",items:[
                {flex:1,id:"mpb1",xtype:"panel"}
               ,{flex:1,id:"mpb2",xtype:"panel"}
                ]
            }
            ,{align:"stretch",flex:1,id:"mp3",layout:"hbox",xtype:"panel",items:[
                {flex:1,id:"mpb3",xtype:"panel"}
                ,{flex:1,id:"mpb4",xtype:"panel"}
                ]
            }
        ]}
        ]}
    );
    I am sure it must be something obvious as this seems such a basic requirement but I just can't seem to get it to work and would appreciate any help.

  2. Can't read your code as it's all jumbled up but here is an example that works for me:

    Code:
    new Ext.Container({
        fullscreen : true,
        layout     : {
            type  : 'hbox',
            align : 'stretch'
        },
        items      : [
            {
                xtype  : 'container',
                flex   : 1,
                layout : {
                    type  : 'vbox',
                    align : 'stretch'
                },
                items  : [
                    {
                        xtype : 'button',
                        flex  : 1,
                        text  : 'Top-Left'
                    },
                    {
                        xtype : 'button',
                        flex  : 1,
                        text  : 'Bottom-Left'
                    }
                ]
            },
            {
                xtype  : 'container',
                flex   : 1,
                layout : {
                    type  : 'vbox',
                    align : 'stretch'
                },
                items  : [
                    {
                        xtype : 'button',
                        flex  : 1,
                        text  : 'Top-Right'
                    },
                    {
                        xtype : 'button',
                        flex  : 1,
                        text  : 'Bottom-Right'
                    }
                ]
            }
        ]
    });

  3. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    36,791
    Answers
    3465
    Vote Rating
    833
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    Can't read your code as it's all jumbled up but here is an example that works for me:

    Code:
    new Ext.Container({
        fullscreen : true,
        layout     : {
            type  : 'hbox',
            align : 'stretch'
        },
        items      : [
            {
                xtype  : 'container',
                flex   : 1,
                layout : {
                    type  : 'vbox',
                    align : 'stretch'
                },
                items  : [
                    {
                        xtype : 'button',
                        flex  : 1,
                        text  : 'Top-Left'
                    },
                    {
                        xtype : 'button',
                        flex  : 1,
                        text  : 'Bottom-Left'
                    }
                ]
            },
            {
                xtype  : 'container',
                flex   : 1,
                layout : {
                    type  : 'vbox',
                    align : 'stretch'
                },
                items  : [
                    {
                        xtype : 'button',
                        flex  : 1,
                        text  : 'Top-Right'
                    },
                    {
                        xtype : 'button',
                        flex  : 1,
                        text  : 'Bottom-Right'
                    }
                ]
            }
        ]
    });
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

    Need more help with your app? Hire Sencha Services services@sencha.com

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is in print!

    When posting code, please use BBCode's CODE tags.

Thread Participants: 1

Turkiyenin en sevilen filmlerinin yer aldigi xnxx internet sitemiz olan ve porn sex tarzi bir site olan mobil porno izle sitemiz gercekten dillere destan bir durumda herkesin sevdigi bir site olarak tarihe gececege benziyor. Sitenin en belirgin ozelliklerinden birisi de Turkiyede gercekten kaliteli ve muntazam, duzenli porno izle siteleri olmamasidir. Bu yuzden iste. Ayrica en net goruntu kalitesine sahip adresinde yayinlanmaktadir. Mesela diğer sitelerimizden bahsedecek olursak, en iyi hd porno video arşivine sahip bir siteyiz. "The Best anal porn videos and slut anus, big asses movies set..." hd porno faketaxi