Hoe to create a XRCed generated scrolled window within aui managed application
===

I try to load panels created with XRCed in a AUI frame. The panels are sometimes larger than the pane and need scrollbars, so I enclosed the content inside a scrolled window. The panel is created but I can not get the scrollbars working. With the scroled window encloed within a sizer, I was expecting this to work as stated in the documentation.
I use the XRCed generated Python code to load the panel.
I am using wxPython version 2.8.12.1 on Windows 7, XRCed version 0.2.0-8 and Python 2.7.

    import wx
    from wx import aui
    from example_xrc import xrcexample
    
    class TopWindow(wx.Frame):
        def __init__(self, *args, **kwargs):
            wx.Frame.__init__(self, *args, **kwargs)
            self._mgr = aui.AuiManager()
            self._mgr.SetManagedWindow(self)
            self._mgr.AddPane(self.create_panel_from_xrc(), aui.AuiPaneInfo().
                              Name("name1").Caption("caption1").CenterPane())
            self._mgr.AddPane(self.create_textctrl(), aui.AuiPaneInfo().
                              Name("name2").Caption("caption2").Bottom())
            self._mgr.GetPane("nam1").Show().Center().Layer(0).Row(0).Position(0)
            self._mgr.GetPane("name2").Show().Bottom().Layer(0).Row(0).Position(0)
            self._mgr.Update()
            
        def create_textctrl(self):
            text = "This is text box"
            return wx.TextCtrl(self, -1, text, wx.Point(0, 0), wx.Size(150, 90),
                               wx.NO_BORDER | wx.TE_MULTILINE)
    
        def create_panel_from_xrc(self):
            return xrcexample(self)
    
    if __name__ == "__main__":
        app = wx.App(0)
        wx.InitAllImageHandlers()
        top_window = TopWindow(None, -1, "")
        top_window.Show()
        app.MainLoop()

The following code is the stripped down code generated by XRCed. The XRC is embedded.

    import wx
    import wx.xrc as xrc
    __res = None
    
    def get_resources():
        global __res
        if __res == None:
            __init_resources()
        return __res
    
    class xrcexample(wx.Panel):
        def PreCreate(self, pre):
            pass
    
        def __init__(self, parent):
            pre = wx.PrePanel()
            self.PreCreate(pre)
            get_resources().LoadOnPanel(pre, parent, "example")
            self.PostCreate(pre)
    
    # ------------------------ Resource data ----------------------
    def __init_resources():
        global __res
        __res = xrc.EmptyXmlResource()
        wx.FileSystem.AddHandler(wx.MemoryFSHandler())
        example_xrc = '''\
    <?xml version="1.0" ?><resource>
      <object class="wxPanel" name="example">
        <style>wxTAB_TRAVERSAL</style>
        <object class="wxBoxSizer">
          <orient>wxVERTICAL</orient>
          <object class="sizeritem">
            <object class="wxScrolledWindow" name="scrolled_window">
              <object class="wxFlexGridSizer">
                <rows>0</rows>
                <cols>2</cols>
                <object class="sizeritem">
                  <object class="wxStaticText">
                    <label>LABEL</label>
                  </object>
                </object>
                <object class="sizeritem">
                  <object class="wxTextCtrl"/>
                </object>
    ... # repeat label / textctrl many times ...
              </object>
            </object>
          </object>
        </object>
      </object>
    </resource>'''
        wx.MemoryFSHandler.AddFile('XRC/example/example_xrc', example_xrc)
        __res.Load('memory:XRC/example/example_xrc')


