我已經編譯和運行時,它顯示了一個簡單的框架這個wxWidgets的測試源代碼:不能集中在Mac OSX wxWidgets的框架與SCons的編譯
/*
* hworld.cpp
* Hello world sample by Robert Roebling
*/
#include "wx-2.8/wx/wx.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);
DECLARE_EVENT_TABLE()
};
enum
{
ID_Quit = 1,
ID_About,
};
BEGIN_EVENT_TABLE(MyFrame, wxFrame)
EVT_MENU(ID_Quit, MyFrame::OnQuit)
EVT_MENU(ID_About, MyFrame::OnAbout)
END_EVENT_TABLE()
IMPLEMENT_APP(MyApp)
bool MyApp::OnInit()
{
MyFrame *frame = new MyFrame(_T("Hello World"), wxPoint(50,50), wxSize(450,340));
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_Quit, _T("E&xit"));
wxMenuBar *menuBar = new wxMenuBar;
menuBar->Append(menuFile, _T("&File"));
SetMenuBar(menuBar);
CreateStatusBar();
SetStatusText(_T("Welcome to wxWindows!"));
}
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);
}
創造了這個簡單的SCons的腳本:
env = Environment()
env.ParseConfig('wx-config --cxxflags --libs')
env.Program(target='wxTest/wxTest.exe',source=['src/Wxwidgets.cpp'])
問題:當我運行它時,它不會集中注意力。我唯一可以關注的是左上角的紅色,黃色和綠色按鈕。 我使用Eclipse作爲我的IDE,並在構建它時運行scons作爲外部工具。
有沒有人知道我做錯了什麼?我如何獲得框架的重點?
希望有人可以幫助我。
請注意,您還應該刪除id枚舉,並使用wxMac中特別處理的預定義的wxID_EXIT和wxID_ABOUT標識符,因爲這些命令的菜單項將移動到應用程序菜單中適當的平臺原生位置。有關更多信息,請參閱http://wiki.wxwidgets.org/WxMac_Issues。 – mghie 2009-06-05 10:49:01