[問題] GUI程式的滑鼠點選問題

看板LinuxDev作者 (阿怪)時間18年前 (2007/06/01 10:55), 編輯推噓0(004)
留言4則, 2人參與, 最新討論串1/1
打聽到了 linux wxWidget(gtk) 手工 build 的方法 g++ file.cpp `wx-config --libs --cxxflags` -o file 其中 wx-config --libs --cxxflags 等於 -I/usr/lib/wx/include/gtk2-unicode-release-2.8 -I/usr/include/wx-2.8 -D_FILE_OFFSET_BITS=64 -D_LARGE_FILES -D__WXGTK__ -pthread -pthread -lwx_gtk2u_aui-2.8 -lwx_gtk2u_xrc-2.8 -lwx_gtk2u_qa-2.8 -lwx_gtk2u_html-2.8 -lwx_gtk2u_adv-2.8 -lwx_gtk2u_core-2.8 -lwx_baseu_xml-2.8 -lwx_baseu_net-2.8 -lwx_baseu-2.8 但不知為何 在term下./wxhello GUI確實出現 但滑鼠點選不能執行 糟糕 哪位先進指點一下吧 code如下(應該沒問題) #include "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() /// ????? why not ';' }; 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("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, "&About..."); menuFile->AppendSeparator(); menuFile->Append(ID_Quit, "E&xit"); wxMenuBar *menuBar=new wxMenuBar; menuBar->Append(menuFile, "&File"); SetMenuBar(menuBar); CreateStatusBar(); SetStatusText("Welcome To wxWidget!"); } void MyFrame::OnQuit(wxCommandEvent& WXUNUSED(event)){ Close(TRUE); } void MyFrame::OnAbout(wxCommandEvent& WXUNUSED(event)){ wxMessageBox("This is an wxWidgets Hello world sample", "About hello ", wxOK|wxICON_INFORMATION, this); } -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 125.225.115.200

06/02 10:07, , 1F
這 code 看起來沒什麼問題。你說的滑鼠點選不能執行意思
06/02 10:07, 1F

06/02 10:09, , 2F
是說點了X、點了menu bar的about或exit都沒反應?
06/02 10:09, 2F

06/02 10:11, , 3F
還是說只能由console keyin command, 滑鼠點選icon無用?
06/02 10:11, 3F

06/14 07:36, , 4F
是我自己build wx時 ./configure沒下好參數 Orz
06/14 07:36, 4F
文章代碼(AID): #16NugyAW (LinuxDev)
文章代碼(AID): #16NugyAW (LinuxDev)