Two step creation of custom derived class

Hi,

I have a problem where I'm stuck.
I install a custom XmlHandler for my own ListCtrl derived class.
When loading the resource the correct class is instanciated. However after
that I can't call any additional method in the class. Anything that's not in
the ListCtrl is missing.
Sample is below. If you try to call DoSomething() later on it raises:

exceptions.AttributeError: wxListCtrlPtr instance has no attribute
'DoSomething'

Is it possible to create a derived class with additional methods ?

Some magic must be happening after the Create() method is called, since the
correct Create() is called when creating the instance.

Any ideas ?

---------------------- snip ---------------------
class PreAWListCtrl(wx.ListCtrl, ListCtrlAutoWidthMixin):
    def __init__(self):
        p = wx.PreListCtrl()
        self.this = p.this

    def Create(self, parent, id, pos, size, style, validator, name):
        wx.ListCtrl.Create(self, parent, id, pos,size,style,validator,name)
        ListCtrlAutoWidthMixin.__init__(self)
        self.Refresh()

    def DoSomething(self):
        print "Blah Blah"

···

--
  UC

--
Open Source Solutions 4U, LLC 2570 Fleetwood Drive
Phone: +1 650 872 2425 San Bruno, CA 94066
Cell: +1 650 302 2405 United States
Fax: +1 650 872 2417

Uwe C. Schroeder wrote:

Some magic must be happening after the Create() method is called, since the correct Create() is called when creating the instance.

Any ideas ?

Yep. You need to add this:;

  self._setOORInfo(self)

to the __init__ (or the Create would probably be okay too.) This is what hooks the Python instance to the C++ instance so that the original Python instance can be returned from C++ methods returning a wxWindow pointer or something.

···

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!

Thanks Robin,

it works either in the __init__ or in the Create. I now put it in the Create
(seems more logical to me :-))

  UC

···

On Tuesday 13 May 2003 11:36 am, Robin Dunn wrote:

Uwe C. Schroeder wrote:
> Some magic must be happening after the Create() method is called, since
> the correct Create() is called when creating the instance.
>
> Any ideas ?

Yep. You need to add this:;

  self._setOORInfo(self)

to the __init__ (or the Create would probably be okay too.) This is
what hooks the Python instance to the C++ instance so that the original
  Python instance can be returned from C++ methods returning a wxWindow
pointer or something.

--
Open Source Solutions 4U, LLC 2570 Fleetwood Drive
Phone: +1 650 872 2425 San Bruno, CA 94066
Cell: +1 650 302 2405 United States
Fax: +1 650 872 2417