Author Topic: wxSmith - Problem creating subclass of wxPanel  (Read 3939 times)

Offline PaulS

  • Multiple posting newcomer
  • *
  • Posts: 25
wxSmith - Problem creating subclass of wxPanel
« on: October 14, 2008, 10:05:04 pm »
If I create a subclass of wxPanel via wxSmith->Add wxPanel it generates a 4 argument CTOR (3 defaults).  The new subclass compiles correctly.

If I then add this part by adding a wxPanel and setting Class name to my subclass name the object is newed with a 6 argument CTOR and fails.  wxPanel, of course,  provides a 6 argument CTOR (5 defaults).  I think my subclass CTOR should also be generated with 6 args (5 defaults).

This is very easy to work around since the CTOR is only written when the new class is created, not when it is later modified.  So I fix it once and it stays fixed.  But, unless I have misunderstood your intent, I am sure you want to correct it.

Paul

Offline byo

  • Plugin developer
  • Lives here!
  • ****
  • Posts: 837
Re: wxSmith - Problem creating subclass of wxPanel
« Reply #1 on: October 16, 2008, 12:32:03 am »
Correct me if I'm wrong - you want to use wxPanel resource in some other resource? If yes, this is covered in this wiki page.

Basically you have two options - either by matching ctor of your custom panel with standard wxPanel ctor or add wxPanel through custom widget.

Regards
   BYO


Offline PaulS

  • Multiple posting newcomer
  • *
  • Posts: 25
Re: wxSmith - Problem creating subclass of wxPanel
« Reply #2 on: October 16, 2008, 01:16:12 am »
Thank you for replying.

I looked at the wiki page and see that I missed the "custom Arguments" field.  I could add the 5th and 6th arguments that way instead of modifying the generated code.

I don't understand why you would want me to do that.  Why isn't a six argument constructor the norm for a wxSmith generated subclass of wxPanel?  That is, why aren't style and name available as check boxes in the "Constructor arguments" section of the "new wxPanel  resource" dialog?  When I use wxSmith to insert my new subclass into a wxFrame the 6 argument ctor is what is needed, seems like it should be the default. 

I guess the same question applies to creating a wxFrame or wxDialog. 

I hope I don't sound argumentative.  I just want to understand the "why" as well as the "how".  I am relatively new and totally self taught in wxWidgets & I'm probably a missing something obvious.  FWIW I am using wxWidgets 2.8.8.  Perhaps the extra arguments first appeared in a recent release?