[問題] GUI程式的滑鼠點選問題
打聽到了 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
06/02 10:07, 1F
→
06/02 10:09, , 2F
06/02 10:09, 2F
→
06/02 10:11, , 3F
06/02 10:11, 3F
→
06/14 07:36, , 4F
06/14 07:36, 4F
LinuxDev 近期熱門文章
PTT數位生活區 即時熱門文章