Since it is the children of the panel that have changing best sizes and need to have their layout redone, then you should call self.pnl.Layout here instead of self.Layout. The layout of the frame's children (just the top-level panel) does not need to change at all.
BTW, the ExpandoTextCtrl has an event (EVT_ETC_LAYOUT_NEEDED) that it emits when its best size is changing so you can also use that to know when a layout is needed.
···
On 2/7/12 7:05 PM, luvspython wrote:
All,
I am unable to get my head around how to have multiple sibling sub-
panels expand as needed, and would greatly appreciate advice on how to
accomplish this.In my real app, I have a Panel class containing a
UltimateListCtrl, and I have a stack of these panel objects in a
parent panel. I want each subpanel to take only as much space as
required to show all rows in the list control (i.e., avoiding a
vertical scrollbar), and no more space than that (i.e., I don't want a
non-zero proportion when it's added to the parent's sizer) and I have
code that figures out the necessary vertical height to accomplish that
and sets the height of the panel. So the panel grows as I add rows.
This all works when I have a single such listctrl-panel.But things don't work when I have a stack of such panels; they
just don't grow.Below is a simplified example. It doesn't use my listctrl-panel
because the demo gets big just with the complexity of adding rows to a
listctrl, so the panel in the example below uses an ExpandoTextCtrl
instead. The subpanels are colored differerently to make things more
obvious, and it adds text to different subpanels every few seconds.There are some commented-out lines that only show a few of the
many things I've tried, to no avail.What I WANT to happen is as each sub-panel's Expando grows
vertically, that colored subpanel should grow so the entire Expando
shows.Any help will be GREATLY appreciated !
def addMore(self):
self.pnlNum = (self.pnlNum + 1) % 3
pnl = [self.expPnl1, self.expPnl2, self.expPnl3]
[self.pnlNum]
pnl.AddText()
wx.CallLater(3000, self.addMore)
self.Layout()
--
Robin Dunn
Software Craftsman