How do I layout this with sizer?

Hi,

I have a scrolled panel which contains:

+-------------+ +-----------+ <------ Panel
  StaticBitmap StaticText
--------------- StaticText
                            .... more controls

···

+-----------+
StaticText
ListCtrl

The current layout structure I used is:

ScrolledPanel
  +----------------- Panel (GridSizer 2 columns, 1 row)
                               +------------ StaticBitmap
                               +------------ Panel (BoxSizer vertical)
                                                     +--------------
StaticText
                                                     +-------------- ....
                                                     +-------------- ....
  +----------------- StaticText
  +----------------- ListCtrl

I don't know the actual size of top right panel, but the top left static
bitmap's size is fixed.
I want the space on bottom of static bitmap being grow automatically so that
the height of left and right will be same.

I tried GridSizer with 2 columns 1 row, but the top right panel will be the
same height as static bitmap,
FlexSizer worse.

How should I do to make it work?

Thanks.

View this message in context: http://www.nabble.com/How-do-I-layout-this-with-sizer--tp19995380p19995380.html
Sent from the wxPython-users mailing list archive at Nabble.com.

blp330 wrote:

I don't know the actual size of top right panel, but the top left static
bitmap's size is fixed.
I want the space on bottom of static bitmap being grow automatically so that
the height of left and right will be same.

I tried GridSizer with 2 columns 1 row, but the top right panel will be the
same height as static bitmap, FlexSizer worse.

I may not have a clear idea of what you want because your ascii art was a bit garbled, but the GridSizer is certainly not what you want as it will always force the items it manages to be the same size. FlexGridSizer would probably work, but I think I would just use nested box sizers. IOW, use a horizontal box sizer where the items are the staticbitmap and the group of other widgets. Then if you don't need the subpanel for any particular reason you can place those widgets on the same panel and just put their vertical box sizer in the horizontal one as the second item.

BTW, be sure to use the WIT as it will help you see item boundaries and such to help you figure out how to solve layout problems. http://wiki.wxpython.org/Widget_Inspection_Tool

···

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!

Robin Dunn wrote:

I may not have a clear idea of what you want because your ascii art was
a bit garbled, but the GridSizer is certainly not what you want as it
will always force the items it manages to be the same size.
FlexGridSizer would probably work, but I think I would just use nested
box sizers. IOW, use a horizontal box sizer where the items are the
staticbitmap and the group of other widgets. Then if you don't need the
subpanel for any particular reason you can place those widgets on the
same panel and just put their vertical box sizer in the horizontal one
as the second item.

BTW, be sure to use the WIT as it will help you see item boundaries and
such to help you figure out how to solve layout problems.
http://wiki.wxpython.org/Widget_Inspection_Tool

I do that, I try to use horizontal box sizer to put staticbitmap and panel
that puts other widgets.
It is the same effect with FlexGridSizer with 2 columns 1 row.

I also used WIT, but I found something I can't understand:

My layout structure now in WIT is:

ScrolledPanel (put inside a auiNotebook) => size = (1066, 222), bestsize =
(667, 471)
+-- Panel1 (BoxSizer horizontal) => size = (360, 154), bestsize = (604,
307)
+-- StaticBitmap => size = (320, 154), bestsize = (320, 154)
+-- SizedPanel (vertical) => size = (40, 154), bestsize = (284, 307),
+-- StaticText
+-- ....
+-- ....
+-- StaticText => size = (48, 14), bestsize = (48, 14)
+-- ListCtrl => size = (640, 256), bestsize = (100, 80)

When I call Panel1.Fit() the size of Panel1 will become (604, 307), I think
that is a correct size, but now I call ScrolledPanel.Fit(), it will make
Panel1's size return to (360, 154). Panel1 will always be cut off.

If I try to Panel1.SetMinSize(Panel1.GetBestSize()), it seems work, but
scolling of ScrolledPanel will broken, now I call ScolledPanel.Fit(),
ScolledPanel.SetupScrolling(), the size of ScrolledPanel will become (667,
471). I think it should be (1066, 471).

I don't know what to do to make it layout correctly.

Thank you very much.

···

--
View this message in context: http://www.nabble.com/How-do-I-layout-this-with-sizer--tp19995380p20006706.html
Sent from the wxPython-users mailing list archive at Nabble.com.