Я новичок ie, я стилизирую wxwidgets и c ++, в этом топи c Я хочу спросить, как создать виджеты (кнопки) из производного класса (APMainFrame, которые наследуют класс MainFrame)
Код MainFrame GUI:
MainFrame::MainFrame( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : wxFrame( parent, id, title, pos, size, style )
{
this->SetSizeHints( wxDefaultSize, wxDefaultSize );
this->SetBackgroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_WINDOWFRAME ) );
.....
this->SetMenuBar( m_menubar1 );
this->Centre( wxBOTH );
}
и код APMainFrame.h:
class APMainFrame : public MainFrame
{
public:
/** Constructor */
APMainFrame( wxWindow* parent );
//// end generated class members
wxButton* HelloWorld; // here i wanna create function and button for GUI
void OnExit(wxCommandEvent& event);
private:
DECLARE_EVENT_TABLE()
};
enum
{
BUTTON_Hello = wxID_HIGHEST + 1
};
и файл APMainFrame. cpp:
BEGIN_EVENT_TABLE(APMainFrame, MainFrame)
EVT_BUTTON(BUTTON_Hello, APMainFrame::OnExit)
END_EVENT_TABLE() // The button is pressed
APMainFrame::APMainFrame( wxWindow* parent )
:
MainFrame( parent )
{
HelloWorld = new wxButton(this, BUTTON_Hello, _T("Hello World"),
// shows a button on this window
wxDefaultPosition, wxDefaultSize, 0);
}
void APMainFrame::OnExit(wxCommandEvent& event)
{
Close(TRUE);
}
Я просто хочу создать виджеты из класса Drived. Большое спасибо.