[wxPython] Bug: wxStaticBox just doesn't seem to show up

Okay, I've attached a small demo of setting up a wxStaticBox in a
sizer-driven dialog just so people don't need to do the experimenting to
figure out which thing gets Add-ed to which thing in order to get the items
"in" the group to show up within the group/static-box.

IMO, the wxStaticBox (or maybe a sub-class?) should encapsulate all the
maintenance stuff like this so that you just treat it like a regular window
that happens to add some stuff around the client area. (See FXPy's Group,
Shutter, etceteras for a nice examples of this approach).

Enjoy,
Mike

···

-----Original Message-----
From: Mike Fletcher [mailto:mfletch@tpresence.com]
Sent: Saturday, November 04, 2000 3:17 PM
To: 'wxpython-users@lists.sourceforge.net'
Subject: RE: [wxPython] Bug: wxStaticBox just doesn't seem to show up

AARRRGGHHH!!! I can't believe I did that again (second time I've spent ages
on the same bloody thing). Any chance of adding this into the wxDialog
class so the two classes can be a little more interchangeable? Or maybe
just a big wxPython note in the wxDialog docs saying "NOTE: Sizers in
wxDialogs will _not_ work unless you explicitly call self.Layout() in your
initialiser"

Sigh. I'm getting feebleminded in my old age, need lots of crutches...
Thanks Robin,
Mike

-----Original Message-----
From: Robin Dunn [mailto:robin@alldunn.com]
Sent: Saturday, November 04, 2000 1:08 PM
To: wxpython-users@lists.sourceforge.net
Subject: Re: [wxPython] Bug: wxStaticBox just doesn't seem to show up

self.SetSizer(outerSizer)
self.SetAutoLayout(true)
EVT_SIZE(self, self.OnSize)
def OnSize (self, event = None):
self.Layout ()

On wxMSW, the dialogs are fixed size and so they don't automatically get a
size event at the begining like wxFrames do, so Layout won't get called
unless yoiu force it in some way.

Adding a call to self.Layout() at the end of _buildPanel() does the trick.
I think changing the size of the dialog after the sizer has been set will do
it also.

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

_______________________________________________
wxPython-users mailing list
wxPython-users@lists.sourceforge.net
http://lists.sourceforge.net/mailman/listinfo/wxpython-users
_______________________________________________
wxPython-users mailing list
wxPython-users@lists.sourceforge.net
http://lists.sourceforge.net/mailman/listinfo/wxpython-users

Okay, I've attached a small demo of setting up a wxStaticBox in a
sizer-driven dialog just so people don't need to do the experimenting to
figure out which thing gets Add-ed to which thing in order to get the

items

"in" the group to show up within the group/static-box.

   alreadyBuiltGroup = wxStaticBox(self, -1, ...)
   innerSizer = wxStaticBoxSizer( alreadyBuiltGroup, wxVERTICAL )
   self.userList = wxListBox ( alreadyBuiltGroup, -1, )

IIRC, the wxStaticBox doesn't behave well in all cases when used as a
parent. It was meant to be a sibling to the windows it "contains." IOW,
the listbox should also be a child of self.

IMO, the wxStaticBox (or maybe a sub-class?) should encapsulate all the
maintenance stuff like this so that you just treat it like a regular

window

that happens to add some stuff around the client area. (See FXPy's Group,
Shutter, etceteras for a nice examples of this approach).

Sounds like a good idea. When can I have a prototype? <wink>

···

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

_______________________________________________
wxPython-users mailing list
wxPython-users@lists.sourceforge.net
http://lists.sourceforge.net/mailman/listinfo/wxpython-users