How do I use custom controls with XRC, that are not derived from the basic widgets set? Im trying to add a GenBitmapButton to a dialog, but I get a 'No handler found for XML node'. I'm guessing I need to define a handler for GenBitmapButtons and add it to the XmlResource, but I'm not sure how.
I don't know if this is the official way to do it, but here's how I do it...
Add the control as an 'unknown' control. In the tool pallet,. it has
a ? as the icon.
In your code, do something like this to "attach" your control -->
xrcres = xrc.XmlResource("/path/to/file.xrc")
···
#
# Create your panel / frame / whatever.. i use "2 phase" construction, so self
# is actually a wx.Frame derived class below
#
pre = wx.PreFrame()
xrcres.LoadOnFrame(pre, None, "main_frame")
# Now "attach" the control... UserCustomizableLogWindow is a little
log widget I wrote..
# The method signature for AttachUnknownControl is
# AttachUnknownControl(self, String name, Window control, Window
parent=None) -> bool
xrcres.AttachUnknownControl("log_wnd", UserCustomizableLogWindow(self),
self)
hth,
jw
On Thu, 17 Mar 2005 16:42:07 +0000, Will McGugan <will@willmcgugan.com> wrote:
Hi,
How do I use custom controls with XRC, that are not derived from the
basic widgets set? Im trying to add a GenBitmapButton to a dialog, but I
get a 'No handler found for XML node'. I'm guessing I need to define a
handler for GenBitmapButtons and add it to the XmlResource, but I'm not
sure how.
Thanks in advance,
Will McGugan
---------------------------------------------------------------------
To unsubscribe, e-mail: wxPython-users-unsubscribe@lists.wxwidgets.org
For additional commands, e-mail: wxPython-users-help@lists.wxwidgets.org
How do I use custom controls with XRC, that are not derived from the basic widgets set? Im trying to add a GenBitmapButton to a dialog, but I get a 'No handler found for XML node'. I'm guessing I need to define a handler for GenBitmapButtons and add it to the XmlResource, but I'm not sure how.
See XmlResourceHandler.py in the demo.
···
--
Robin Dunn
Software Craftsman http://wxPython.org Java give you jitters? Relax with wxPython!