How can I use the wx.LC_VIRTUAL style from a wx.ListCtrl on a dialog
loaded from XRC?
The obvious way would be to subclass, override the OnGetItemXXX methods,
write an XML handler for the new control class and put a placeholder in
my xrc. But I thought that it is too much a pain for such a simple task.
Is there another, easier, way?
How can I use the wx.LC_VIRTUAL style from a wx.ListCtrl on a dialog
loaded from XRC?
The obvious way would be to subclass, override the OnGetItemXXX methods,
write an XML handler for the new control class and put a placeholder in
my xrc. But I thought that it is too much a pain for such a simple task.
Is there another, easier, way?
You can use the subclass attribute in the XRC to tell it to use your subclass instead of a bare wx.ListCtrl. You'll need to do a little trickery in the __init__ to get it to work, see the demo for an example.
Another, slightly dirty, approach that might work in this case is to use monkey-patching to inject the OnGetItem* methods into the listctrl instance at runtime. In other words, get the instance of the listctrl using XRCCTRL and then assign to it the methods that you've defined as functions in your code.