Thank you very much for your response.
It worked fine, with a very few lines of code.
Here they are, for those who needs :
class wxDataViewCtrlXmlHandler(xrc.XmlResourceHandler):
def init(self):
xrc.XmlResourceHandler.init(self)
Specify the styles recognized by wxDataViewCtrl
self.AddStyle(‘wxDV_SINGLE’, dv.DV_SINGLE)
self.AddStyle(‘wxDV_MULTIPLE’, dv.DV_MULTIPLE)
self.AddStyle(‘wxDV_ROW_LINES’, dv.DV_ROW_LINES)
self.AddStyle(‘wxDV_HORIZ_RULES’, dv.DV_HORIZ_RULES)
self.AddStyle(‘wxDV_VERT_RULES’, dv.DV_VERT_RULES)
self.AddStyle(‘wxDV_VARIABLE_LINE_HEIGHT’, dv.DV_VARIABLE_LINE_HEIGHT)
self.AddStyle(‘wxDV_NO_HEADER’, dv.DV_NO_HEADER)
self.AddWindowStyles()
Required methods for XmlResourceHandlers
def CanHandle(self, node):
return self.IsOfClass(node, ‘wxDataViewCtrl’)
def DoCreateResource(self):
Be sure that there is no existing instance
assert self.GetInstance() is None
Now create the object
ctrl = dv.DataViewCtrl(self.GetParentAsWindow(),
self.GetID(),
self.GetPosition(),
self.GetSize(),
self.GetStyle(“style”, 0),
wx.DefaultValidator,
self.GetName()
)
Set standard window attributes
self.SetupWindow(ctrl)
Create any child windows of this node
self.CreateChildren(ctrl)
return ctrl
Regards
Xav’
···
On Thursday, March 15, 2018 at 1:28:10 AM UTC+1, Robin Dunn wrote:
You didn’t do anything wrong. The problem is exactly what it says, there is no built-in C++ wxXmlResourceHandler for the wxDataViewCtrl class for some reason. You can make one yourself however, there is an example in the demo that shows how to do it for a custom panel class.
–
Robin