[wxPython] Problem with wxBoxSizer

Hi all,

I have a vertical wxBoxSizer, I add a ListBox, and then addanother
horizontal wxBoxSizer with three buttons.

It appears the two rows that are created are being forced to the size of the
largest row. i.e. the list box has a height of 300, so both rows are height
300, even though the button row should only have a height of like 50
(GetMinSize() returns the correct dimensions), so it looks very wierd (there
is a lot of space at the bottom of the frame)

I looked in the docs for clarification, but didn't see anything. Any
thoughts?

Thanks for any help,
Sean
sleach@netlojix.com

I have a vertical wxBoxSizer, I add a ListBox, and then addanother
horizontal wxBoxSizer with three buttons.

It appears the two rows that are created are being forced to the size of

the

largest row. i.e. the list box has a height of 300, so both rows are

height

300, even though the button row should only have a height of like 50
(GetMinSize() returns the correct dimensions), so it looks very wierd

(there

is a lot of space at the bottom of the frame)

If you are adding them like this then that is the correct behaviour:

    sizer.Add(listBox, 1)
    sizer.Add(otherSizer, 1)

For box sizers those 1's mean that the item is resizable and it is also a
ratio of how much of the free space should be given to the item. In this
case all the options add up to two, so each item will get 1/2 of the
avalable space. If you had used 2 for one and 1 for the other then it would
be 2/3 and 1/3.

If you want the items to be fixed size then use zero.

···

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

That did it even though I could have sworn I had them as 0's and it still
didn't work. Oh well, thanks a bunch!

Sean

···

-----Original Message-----
From: wxpython-users-admin@lists.wxwindows.org
[mailto:wxpython-users-admin@lists.wxwindows.org]On Behalf Of Robin Dunn
Sent: Thursday, June 14, 2001 11:18 AM
To: wxpython-users@lists.wxwindows.org
Subject: Re: [wxPython] Problem with wxBoxSizer

I have a vertical wxBoxSizer, I add a ListBox, and then addanother
horizontal wxBoxSizer with three buttons.

It appears the two rows that are created are being forced to the size of

the

largest row. i.e. the list box has a height of 300, so both rows are

height

300, even though the button row should only have a height of like 50
(GetMinSize() returns the correct dimensions), so it looks very wierd

(there

is a lot of space at the bottom of the frame)

If you are adding them like this then that is the correct behaviour:

    sizer.Add(listBox, 1)
    sizer.Add(otherSizer, 1)

For box sizers those 1's mean that the item is resizable and it is also a
ratio of how much of the free space should be given to the item. In this
case all the options add up to two, so each item will get 1/2 of the
avalable space. If you had used 2 for one and 1 for the other then it would
be 2/3 and 1/3.

If you want the items to be fixed size then use zero.

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

_______________________________________________
wxpython-users mailing list
wxpython-users@lists.wxwindows.org
http://lists.wxwindows.org/mailman/listinfo/wxpython-users

Add( window, relativeSize, whetherToExpandSideways+Borders+Margins)

Use 0 for relativeSize to have a non-vertically-expanding object. You
likely used 1 for both objects, which says their relative sizes are 1:1.

HTH,
Mike

···

-----Original Message-----
From: wxpython-users-admin@lists.wxwindows.org
[mailto:wxpython-users-admin@lists.wxwindows.org]On Behalf Of Sean Leach
Sent: June 14, 2001 13:51
To: wxpython-users@lists.wxwindows.org
Subject: [wxPython] Problem with wxBoxSizer

Hi all,

I have a vertical wxBoxSizer, I add a ListBox, and then addanother
horizontal wxBoxSizer with three buttons.

It appears the two rows that are created are being forced to the size of the
largest row. i.e. the list box has a height of 300, so both rows are height
300, even though the button row should only have a height of like 50
(GetMinSize() returns the correct dimensions), so it looks very wierd (there
is a lot of space at the bottom of the frame)

I looked in the docs for clarification, but didn't see anything. Any
thoughts?

Thanks for any help,
Sean
sleach@netlojix.com

_______________________________________________
wxpython-users mailing list
wxpython-users@lists.wxwindows.org
http://lists.wxwindows.org/mailman/listinfo/wxpython-users