Witam, mam następujący problem z Buttonem, piszę właśnie projekt z wykorzystaniem biblioteki graficznej wxWigdgets, dodaję do "formatki" Button, jednakże ten Button rozciąga się na całą formatkę ;/, w czym tkwi problem?,
Kod:
#include "wx/wx.h"
#include "wx/combobox.h"
class MyApp: public wxApp
{
virtual bool OnInit();
};
class MyFrame: public wxFrame
{
public:
MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size);
void OnQuit(wxCommandEvent& event);
void OnAbout(wxCommandEvent& event);
void OnExample(wxCommandEvent& event);
DECLARE_EVENT_TABLE()
};
enum
{
ID_Quit = 1,
ID_About,
ID_Example,
ID_COMBOBOX,
ID_Button
};
BEGIN_EVENT_TABLE(MyFrame, wxFrame)
EVT_MENU(ID_Quit, MyFrame::OnQuit)
EVT_MENU(ID_About, MyFrame::OnAbout)
EVT_MENU(ID_Example, MyFrame::OnExample)
EVT_BUTTON(ID_Button, MyFrame::OnQuit)
END_EVENT_TABLE()
IMPLEMENT_APP(MyApp)
bool MyApp::OnInit()
{
MyFrame *frame = new MyFrame( _T("Projekt2"), wxPoint(700,300), wxSize(600, 450) );
frame->Show(TRUE);
SetTopWindow(frame);
return TRUE;
}
MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size)
: wxFrame((wxFrame *)NULL, -1, title, pos, size)
{
wxMenu *menuFile = new wxMenu;
menuFile->Append( ID_About, _T("&About...") );
menuFile->AppendSeparator();
menuFile->Append( ID_Example, _T("Ex&le") );
menuFile->AppendSeparator();
menuFile->Append( ID_Quit, _T("E&xit") );
wxMenu *menuEdit = new wxMenu;
menuEdit->Append( ID_About, _T("&About"));
wxMenuBar *menuBar = new wxMenuBar;
menuBar->Append( menuFile, _T("&File") );
menuBar->Append( menuEdit, _T("E&dit") );
SetMenuBar( menuBar );
CreateStatusBar();
SetStatusText( _T("Projekt2") );
wxButton* button = new wxButton(this, wxID_OK, wxT("&Button"), wxPoint(10, 10));
}
void MyFrame::OnQuit(wxCommandEvent& WXUNUSED(event))
{
Close(TRUE);
}
void MyFrame::OnAbout(wxCommandEvent& WXUNUSED(event))
{
wxMessageBox(_T("This is a wxWindows Hello world sample"),
_T("About Hello World"), wxOK | wxICON_INFORMATION, this);
}
void MyFrame::OnExample(wxCommandEvent& WXUNUSED(event))
{
wxMessageBox(_T("This is an example"),
_T("An easy example"), wxOK | wxICON_INFORMATION, this);
}
Dzięki z góry za pomoc, pozdrawiam Krzysiek</image>