Until wx.StaticBox is doing something smarter about its client size and origin than using the same size as the whole widget then you'll need to compensate by adding some border space to the item(s) added to the staticbox's sizer.
It looks like at least wxOSX-Cocoa is already adjusting the client size, but wxMSW is not. So you can probably use a test something like this to know if you need to add some border space:
if sbox.Size == sbox.ClientSize:
# add some border space to the items
···
On 4/25/12 3:12 AM, Werner wrote:
I'll start a new thread instead of hijacking Che's.
I was confused on how this should work in 2.9.3, thought controls should
be siblings and not children.
So, based on previous posts and looking at the wxPhoenix doc I
understand that in 2.9.3 the recommended way is:
- parent
-- StaticBox
--- BoxSizer with SetSizer(staticbox)
---- controls as children of StaticBox and added to BoxSizer
In 2.9.3.1 on Win this doesn't work for me, unless I still haven't had
enough coffee;-) .
Attached is what I did and the problem is that the StaticBox does not
wrap the children, instead there is some overlap.
Can anyone see what I am doing wrong on this?
Werner
P.S.
Also tried it without sized controls, but still same issue.
Until wx.StaticBox is doing something smarter about its client size and origin than using the same size as the whole widget then you'll need to compensate by adding some border space to the item(s) added to the staticbox's sizer.
It looks like at least wxOSX-Cocoa is already adjusting the client size, but wxMSW is not. So you can probably use a test something like this to know if you need to add some border space:
if sbox.Size == sbox.ClientSize:
# add some border space to the items
Had a go at it, add additional border and add a spacer at the top to push things down, looks fine. BUT, I can't get the StaticBox to size just large enough arounds its children. If I expand and use proportion=1 I can see the children correctly placed, but it is obviously not what I want as the overall control is too large.
Will the fix to StaticBox be in the next 2.9.x release? If it is I will wait for that.
Until wx.StaticBox is doing something smarter about its client size
and origin than using the same size as the whole widget then you'll
need to compensate by adding some border space to the item(s) added to
the staticbox's sizer.
It looks like at least wxOSX-Cocoa is already adjusting the client
size, but wxMSW is not. So you can probably use a test something like
this to know if you need to add some border space:
if sbox.Size == sbox.ClientSize:
# add some border space to the items
Had a go at it, add additional border and add a spacer at the top to
push things down, looks fine. BUT, I can't get the StaticBox to size
just large enough arounds its children. If I expand and use proportion=1
I can see the children correctly placed, but it is obviously not what I
want as the overall control is too large.
Will the fix to StaticBox be in the next 2.9.x release? If it is I will
wait for that.