1. #1
    Sencha User g2mac's Avatar
    Join Date
    Jun 2009
    Location
    Odessa, Ukraine
    Posts
    69
    Vote Rating
    0
    g2mac is on a distinguished road

      0  

    Question BoxLayout problem with child resizing

    BoxLayout problem with child resizing


    I work with V|HBoxLayouts. In my app I can resize child items (with help of Ext.Resizable) inside BoxContainers after render. But resizing just doesn't work. After releasing of mouse button child returns to initial width or height (depends on HBox or VBox).
    After a couple of hours I figured out that in method Ext.layout.HBoxLayout.calculateChildBoxes(...)
    we have:
    Code:
    ....
    //gather the total flex of all flexed items and the width taken up by fixed width items
             for (i = 0; i < visibleCount; i++) {
                    child       = visibleItems[i];
                    childHeight = child.height;
                    childWidth  = child.width;
    ....
    So, we need component's properties height and width. But method .setSize(w,h) which I use to set new size doesn't set .height and .width if component was already rendered. And I need to set them manually after setSize().

    I think it's strange... or do I something wrong?

  2. #2
    Sencha - Community Support Team jay@moduscreate.com's Avatar
    Join Date
    Mar 2007
    Location
    DC Area =)
    Posts
    16,364
    Vote Rating
    81
    jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all

      0  

    Default


    are you using setSize on the element or the instance of the Container?

  3. #3
    Sencha User g2mac's Avatar
    Join Date
    Jun 2009
    Location
    Odessa, Ukraine
    Posts
    69
    Vote Rating
    0
    g2mac is on a distinguished road

      0  

    Default


    Quote Originally Posted by jgarcia@tdg-i.com View Post
    are you using setSize on the element or the instance of the Container?
    on instance of the Container

  4. #4
    Sencha - Ext JS Dev Team Animal's Avatar
    Join Date
    Mar 2007
    Location
    Notts/Redwood City
    Posts
    30,544
    Vote Rating
    64
    Animal is a jewel in the rough Animal is a jewel in the rough Animal is a jewel in the rough

      0  

    Default


    Does the item you resize contain a flex config?

    Theoretically, you just need to resize the item, and call doLayout on the owning H/Vbox Container.

  5. #5
    Sencha User g2mac's Avatar
    Join Date
    Jun 2009
    Location
    Odessa, Ukraine
    Posts
    69
    Vote Rating
    0
    g2mac is on a distinguished road

      0  

    Default


    Quote Originally Posted by Animal View Post
    Does the item you resize contain a flex config?
    No

    Theoretically, you just need to resize the item, and call doLayout on the owning H/Vbox Container.

    I do exactly the same.

    Code:
    handleResize : function(box){
            var rz = this.resizeBox;
            if(rz.x != box.x || rz.y != box.y){
                this.updateBox(box);
            }else{
                this.setSize(box);
                if (Ext.isIE6 && Ext.isStrict) {
                    this.doLayout();
                }
            }
            this.width = box.width;
            this.height = box.height;
            this.ownerCt.doLayout();
            this.updateHandles();
        },
    I use Ext.Window.handleResize method, except code marked with red

  6. #6
    Sencha - Ext JS Dev Team Animal's Avatar
    Join Date
    Mar 2007
    Location
    Notts/Redwood City
    Posts
    30,544
    Vote Rating
    64
    Animal is a jewel in the rough Animal is a jewel in the rough Animal is a jewel in the rough

      0  

    Default


    You are not setting the size!

    You are just setting some properties!

  7. #7
    Sencha User g2mac's Avatar
    Join Date
    Jun 2009
    Location
    Odessa, Ukraine
    Posts
    69
    Vote Rating
    0
    g2mac is on a distinguished road

      0  

    Default


    I'm not, but this.ownerCt.doLayout() set sizes of child items by calling Ext.layout.(H|V)BoxLayout.calculateChildBoxes(...)

Similar Threads

  1. resizing boxlayout items
    By MichaelOstrovsky in forum Ext 3.x: Help & Discussion
    Replies: 1
    Last Post: 13 Sep 2010, 12:12 PM
  2. Window resizing by its child components
    By g2mac in forum Ext 3.x: Help & Discussion
    Replies: 2
    Last Post: 12 Aug 2009, 7:38 AM
  3. [2.2] Panel's Child Panels Not Resizing Properly - IE 7
    By carl23934 in forum Ext 2.x: Help & Discussion
    Replies: 18
    Last Post: 3 Nov 2008, 12:48 AM
  4. Replies: 1
    Last Post: 14 Jul 2008, 8:47 AM

Thread Participants: 2

Tags for this Thread