[Boa Constr] More on sizers and automatic adjustments
Status: Beta
Brought to you by:
riaan
From: Barry T. <py...@po...> - 2004-09-25 03:09:19
|
Thanks to Werner F. Bruhin for the previous response to my sizers query. I'm having more luck with them now, but still have some questions. Say I have a horizontal boxSizer that has a static text field, a text entry control, and another static text field. I want the text entry control to grow or shrink when the containing frame changes size, and that much I have. But I also want the text entry control to grow or shrink based on the size of the surrounding static text fields. The static text field says that by default, the control will adjust its size to exactly fit the size of the text when you call SetLabel. How, then, do I configure the sizers to be watching for that change in the size of the label, so it will resize the text control when the label text changes? The boxSizer is set like this: def _init_coll_boxSizer2_Items(self, parent): # generated method, don't edit parent.AddWindow(self.staticText1, 0, border=0, flag=wxGROW) parent.AddWindow(self.txtFirst, 1, border=0, flag=wxGROW) parent.AddWindow(self.staticText2, 0, border=0, flag=wxGROW) The staticText fields are defined with no flags, because the only flags available are to align left, center or right, or to ensure that the field does not resize when the text changes. After using staticText.SetLabel('New text label contents here'), is there a method of the sizer I can call to have things readjust? The documentation tells me I shouldn't ever call RecalcSizes on my own. Thanks for any assistance! -- Barry Tice |