wx.HtmlListBox with wxp tags not possible?

Hi,
Did anyone succeed to make wx.HtmlListBox work with wxp tags? As an example, replace the code for MyHtmlListBox(wx.HtmlListBox) with:

import wx.lib.wxpTag

class MyHtmlListBox(wx.HtmlListBox):

    def OnGetItem(self, n):
        return """<wxp module="wx" class="Button" width="50%">
    <param name="label" value="It works!">
    <param name="id" value="-1">
</wxp>
"""

If this is not possible, could it be implemented by a wx.html.HtmlWinTagHandler? How would the above example look like?

Also I noted the existence of wx.SimpleHtmlListBox. Is this an internal class or can it be used?

Stani

Stani's Python Editor wrote:

Hi,
Did anyone succeed to make wx.HtmlListBox work with wxp tags? As an example, replace the code for MyHtmlListBox(wx.HtmlListBox) with:

import wx.lib.wxpTag

class MyHtmlListBox(wx.HtmlListBox):

   def OnGetItem(self, n):
       return """<wxp module="wx" class="Button" width="50%">
   <param name="label" value="It works!">
   <param name="id" value="-1">
</wxp>
"""

Looks like there is some code in wxHtmlWidgetCell that assumes that the parent of the widget will always be a wxScrolledWindow, and it is typecasting the parent pointer to that type in order to call GetViewStart. Since the wx.HtmlListBox doesn't derive from wxScrolledWindow this can cause a crash, or at least unstable behavior.

If this is not possible, could it be implemented by a wx.html.HtmlWinTagHandler?

That is how the wxp tag handler is implemented already.

Also I noted the existence of wx.SimpleHtmlListBox. Is this an internal class or can it be used?

It can be used. Basically it is a wx.HtmlListBox that you don't need to derive from and override methods to be able to use. You just set item values like a normal listbox.

···

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