Menu

Best practices for subclassed wxControls

Anonymous
2003-02-25
2003-03-18
  • Anonymous

    Anonymous - 2003-02-25

    I have created a subclass of wxHtmlWindow that handles <form> specially.  I inserted a standard wxHtmlWindow into a wxFrame in the designer, saved it, then imported my subclass and changed wxHtmlWindow to htmlwindow.HtmlWindow (my subclass).

    I immediately noticed that I could no longer manage my frame in the designer, I assume because Boa does not know how to display my HtmlWindow.  I don't know whether to call this a bug or not.  It would be nice if Boa at least left my code alone and drew a bounding box around my control on the Frame.

    What are best practices for using modified controls?  Do you build everything else in the Frame and then, when you're happy with that, make the modification last?

    I can already see this causing problems if I want to create a modified container and place standard controls inside it, something wxPython will let me do but Boa will not...

     
    • Riaan Booysen

      Riaan Booysen - 2003-02-25

      Hi Cory,

      Boa has built in support to handle this, please read the ExtendingBoa.html page in the documentation.
      To do this you would use the "Custom Classes" feature.

      Some notes:
      * Don't use the htmlwindow.HtmlWindow form, import and use the name directly.
      * Make sure your subclass has the exact same constructor parameters as the wxPython class you derive from.

      Cheers,
      Riaan.

       
    • Anonymous

      Anonymous - 2003-03-18

      Thanks riaan, although the trick I wanted was not in ExtendingBoa.html but in MixingSource.html.  (grepping 'Custom Classes' found it.)

      When I made the suggested changes and added _custom_classes to my wxFrame everything worked. 

       
    • Anonymous

      Anonymous - 2003-03-18

      Thanks riaan, although the trick I wanted was not in ExtendingBoa.html but in MixingSource.html.  (grepping 'Custom Classes' found it.)

      When I made the suggested changes and added _custom_classes to my wxFrame everything worked. 

       

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.