Panel too small for sizers

Hi,

I have a AUI app where in one the panes I have a panel created as follows:

self.propertyPanel = wx.Panel(self,-1,wx.Point(0,0),wx.Size(MINWIDTH,1200))

1200 is something I need to fix. Ideally the panel should fit to its contents.

Anyway, I create two panels I can switch between. The parent is
self.propertyPanel. On of these panels have a lot of collapsible panes
with controls.

This is the way I fill this panel:

def fillControls(self,object):
    properties = object.getProperties()
    panelSizer = wx.BoxSizer(wx.VERTICAL)
    if properties == None:
      text = wx.StaticText(self,-1,_("No object selected"))
      panelSizer.Add(text)
    else:
      i = 0
      MINWIDTH = 0
      MINHEIGHT = 0
      for section in properties.getSections():
        cp = wx.CollapsiblePane(self, label=properties.getSectionName(section),
    
style=wx.CP_DEFAULT_STYLE|wx.CP_NO_TLW_RESIZE)
        self.Bind(wx.EVT_COLLAPSIBLEPANE_CHANGED, self.OnPaneChanged, cp)
        j = 0
        sizer = wx.GridBagSizer(0,0)
        parent = cp.GetPane()
        for prop in properties.getProperties(section):
          if prop.type != shared.DICT:
            sizer.Add(wx.StaticText(parent, -1, prop.text ), (j,0))
            sizer.Add(self.getControl(parent,prop), (j,1))
          else:
            sizer.Add(self.getControl(parent,prop), (j,0),(1,2))
          j += 1
        border = wx.BoxSizer()
        border.Add(sizer, 1, wx.EXPAND|wx.ALL, 5)
        parent.SetSizer(border)
        width = border.GetMinSize().GetWidth()
        height = border.GetMinSize().GetHeight()
        if MINWIDTH < width:
          MINWIDTH = width
        if MINHEIGHT < height:
          MINHEIGHT = height

        i += 1
        panelSizer.Add(cp,0, wx.RIGHT|wx.LEFT|wx.EXPAND, 0)
      
      panelSizer.SetMinSize(wx.Size(MINWIDTH,MINHEIGHT+300)) #FIXME
    self.SetSizerAndFit(panelSizer)

  def OnPaneChanged(self, evt=None):
          self.Layout()

As you can see from the #FIXME I set the minimum size of this panel;
otherwise some of my controls gets cut off in the bottom when I
uncollapse the panes.

The self.Layout does not to fix this issue.

Can anybody give me some hints on what I might be doing wrong?

/Chris