Developer forums (C::B DEVELOPMENT STRICTLY!) > Development
wxSmith : add option for Create function in inhereited cases
(1/1)
LR83:
I have a problem when I want to inherit from my custom panel. wxSmith add automatically this Create function:
--- Code: ---Create(parent, id, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL, _T("id"));
--- End code ---
But my constructor is:
--- Code: ---myNewPanel::myNewPanel(wxWindow* parent, wxWindowID id): myPanel(parent, id)
--- End code ---
so I need each time to comment the bad Create line.
Is it possible to add an option to prevent this line from being added automatically, such as the "Lay-out the window" option?
And another point, is it possible to add another option for the "Lay-out the window" option to have the choice beetwen SetSizeHints(this) and Fit(this) ?
LR83:
I try to add the option.
- Add m_Create property in wxsBaseProperties
- wxsItem::GetCreatePrefix, test the m_Create property. If false, I just add '//' before the Create function. So we can always see the parameters of the Create function (may be usefull).
Work for my project but I don't know if my solution is always good.
See the corrected files in the attachment.
ollydbg:
Hi, I use some my own defined wxWidgets control from time to time. When I try to add this custom control in the wxSmith GUI designer, you can select the "Custom" control, and define the constructor yourself.
Is this the case I describe above?
LR83:
Not exactly, in my case it's about inherited classes.
For example, we have a first class that inherits from wxPanel: wxMyPanel. Then a second class that inherits from wxMyPanel with different parameters. For this second class, we don't want to use the Create function but inheritance directly in the constructor.
This is also possible with first class. For example:
Header:
--- Code: ---class wxMyPanel: public wxPanel
{
public:
wxMyPanel(wxWindow* parent, wxWindowID id);
virtual ~wxMyPanel();
protected:
// Other declarations
};
--- End code ---
Code:
--- Code: ---wxMyPanel::wxMyPanel(wxWindow* parent, wxWindowID id)
{
//(*Initialize(wxMyPanel)
Create(parent, id, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL, _T("id"));
// Other declarations
}
--- End code ---
Or directly:
--- Code: ---wxMyPanel::wxMyPanel(wxWindow* parent, wxWindowID id): wxPanel(parent, id)
{
//(*Initialize(wxMyPanel)
// Other declarations
}
--- End code ---
Navigation
[0] Message Index
Go to full version