Subclass wxTextCtr
Posted: Mon Apr 06, 2020 6:21 am
This is probably a newbie c++ issue. I am trying to use a subclass on a wxTextCtrl.
The text control appears correctly without a subclass. It does not appear at all when using the Subclass.
Steps to modify the functioning code without the Subclass:
1. Enter messagePane for the Subclass Class Name
2. Enter Message Frame.h for the include file
3. Hit the gear to Generate C++ and XRC code
4. File>Generate Code
5. Build -- no build warnings or errors
MessageFrame.h contents:
___________________________________________________________________
class messagePane : public wxTextCtrl
{
public:
messagePane(wxWindow *parent,
wxWindowID id,
const wxString &value = wxEmptyString,
const wxPoint &pos = wxDefaultPosition,
const wxSize &size = wxDefaultSize,
long style = 0,
const wxValidator& validator = wxDefaultValidator,
const wxString &name = wxTextCtrlNameStr);
};
___________________________________________________________________
MessageFrame.cpp contents:
___________________________________________________________________
#include <wx/wx.h>
#include "MessageFrame.h"
messagePane ::messagePane(wxWindow *parent,
wxWindowID id,
const wxString &value,
const wxPoint &pos,
const wxSize &size,
long style,
const wxValidator& validator,
const wxString &name)
{
wxTextCtrl(parent,
id,
value,
pos,
size,
style,
validator,
name);
};
___________________________________________________________________
The text control appears correctly without a subclass. It does not appear at all when using the Subclass.
Steps to modify the functioning code without the Subclass:
1. Enter messagePane for the Subclass Class Name
2. Enter Message Frame.h for the include file
3. Hit the gear to Generate C++ and XRC code
4. File>Generate Code
5. Build -- no build warnings or errors
MessageFrame.h contents:
___________________________________________________________________
class messagePane : public wxTextCtrl
{
public:
messagePane(wxWindow *parent,
wxWindowID id,
const wxString &value = wxEmptyString,
const wxPoint &pos = wxDefaultPosition,
const wxSize &size = wxDefaultSize,
long style = 0,
const wxValidator& validator = wxDefaultValidator,
const wxString &name = wxTextCtrlNameStr);
};
___________________________________________________________________
MessageFrame.cpp contents:
___________________________________________________________________
#include <wx/wx.h>
#include "MessageFrame.h"
messagePane ::messagePane(wxWindow *parent,
wxWindowID id,
const wxString &value,
const wxPoint &pos,
const wxSize &size,
long style,
const wxValidator& validator,
const wxString &name)
{
wxTextCtrl(parent,
id,
value,
pos,
size,
style,
validator,
name);
};
___________________________________________________________________