# Panel with FlexGridSizer not collapsing correctly

**URL:** <https://www.ruby-forum.com/t/panel-with-flexgridsizer-not-collapsing-correctly/198392>\
**Category:** wxRuby\
**Created:** [October 31, 2010, 10:02am UTC](https://www.ruby-forum.com/t/panel-with-flexgridsizer-not-collapsing-correctly/198392 "2010-10-31T10:02:25Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![okkezSS](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/o/85f322/32.png) [@okkezSS](https://www.ruby-forum.com/u/okkezSS)\
**Post date:** [October 31, 2010, 10:02am UTC](https://www.ruby-forum.com/t/panel-with-flexgridsizer-not-collapsing-correctly/198392/1 "2010-10-31T10:02:25Z")

</div>

I have a custom class extending Panel for drawing lines, which shows an  
400-value array being sorted. The application does 6 at a time and so  
there is a Panel (“gridPanel”) with a 2x3 GridSizer managing them. Each  
cell contains another Panel (“arrayBorderPanel”) with a 2x1  
FlexGridSizer. The top row holds a Panel (“drawPanel” – a 1x1  
GridSizer) with the custom panel centered in it, and the bottom holds  
several StaticTexts in a Panel (“infoPanel”) with 1x3 FlexGridSizer.  
The column and the top row of each arrayBorderPanel are growable. The  
infoPanels have growable columns but not rows.

The frame expands correctly, with the column of the arrayBorderPanel  
expanding horizontally but only the top row growing vertically, and the  
custom panels auto-center. The problem is when the frame is decreased  
below the original size. In other guis I’ve used the drawPanels shrink  
vertically but the infoPanels stay fixed.

With WxRuby the infoPanels are the first to disappear. I need these to  
stay put. Right now both drawPanels and infoPanels are added to sizers  
with a proportion of 0 and the EXPAND flag. I’ve tried giving one or  
the other a proportion of 1 and/or removing the EXPAND flag from the  
infoPanel sizer but this doesn’t change anything. I have tried  
set\_min\_size on the infoPanel but no change there either. It does work  
with I set the min size on the infoPanels to the size it needs (about  
100x15) while setting the min size on the drawPanels to something  
smaller than it needs (like 10x10), but then Frame.fit doesn’t work  
right any more. I suppose I could figure out how big it should be and  
set the frame size manually, but that wouldn’t be very portable.

Any help appreciated.

---

<div class="post-metadata">

**Author:** ![galen](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/ecc23a/32.png) [@galen](https://www.ruby-forum.com/u/galen)\
**Post date:** [October 31, 2010, 11:32pm UTC](https://www.ruby-forum.com/t/panel-with-flexgridsizer-not-collapsing-correctly/198392/2 "2010-10-31T23:32:04Z")

</div>

Oh, I got it. Do everything, call Frame.fit, then set min\_height on  
both sets of Frames.
