From: Bell J. <jbe...@ya...> - 2002-04-09 11:30:45
|
I'm trying to move from using layout constraints to the wonderful world of wxSizers. However, I have come across what is undoubtedly a pretty basic problem that I can't see my way through. The problem boils down to the behaviour of spacers in nested sizers. If I create a wxStaticText control (lbl1) and a wxTextCtrl (fld1) I can lay them out vertically with spacers above and below with: box=wxBoxSizer(wxVERTICAL) box.Add(1,1,1,wxEXPAND) box.Add(self.lbl1) box.Add(self.fld1) box.Add(1,1,1,wxEXPAND) self.SetAutoLayout(true) self.SetSizer(box) self.Layout() Changing wxVERTICAL to wxHORIZONTAL works fine too. However, if boxes are nested as in: box=wxBoxSizer(wxVERTICAL) box2=wxBoxSizer(wxHORIZONTAL) box2.Add(1,1,1,wxEXPAND) box2.Add(self.lbl1) box2.Add(self.fld1) box2.Add(1,1,1,wxEXPAND) box.Add(1,1,1,wxEXPAND) box.Add(box2) box.Add(1,1,1,wxEXPAND) self.SetAutoLayout(true) self.SetSizer(box) self.Layout() the vertical layout is as expected, but the spacers in the nested box (box2) don't expand. Ie. everything's on the left. I assumed that a Layout() on box and/or box2 was required but can find no combination that works. Thanks in Advance, John Bell __________________________________________________ Do You Yahoo!? Yahoo! Tax Center - online filing with TurboTax http://taxes.yahoo.com/ |