Events 带有自定义事件的wxWidgets事件表
我试图在我的Events 带有自定义事件的wxWidgets事件表,events,wxwidgets,Events,Wxwidgets,我试图在我的wxWidgets应用程序中实现一个自定义事件,但我无法以正确的方式编写事件表宏 我用于实现事件的文件如下所示: .h文件 #ifndef __APP_FRAME_H__ #define __APP_FRAME_H__ #include "wx/wxprec.h" #ifndef WX_PRECOMP #include "wx/wx.h" #endif #include <wx/evtloop.h> #include "wxApp.h" #include "sam
wxWidgets
应用程序中实现一个自定义事件,但我无法以正确的方式编写事件表宏
我用于实现事件的文件如下所示:
.h
文件
#ifndef __APP_FRAME_H__
#define __APP_FRAME_H__
#include "wx/wxprec.h"
#ifndef WX_PRECOMP
#include "wx/wx.h"
#endif
#include <wx/evtloop.h>
#include "wxApp.h"
#include "sampleCefApp.h"
class appFrame: public wxFrame
{
public:
appFrame(const wxString &title, const wxPoint &pos, const wxSize &size);
private:
int OnExit();
void OnCefStartEvent(wxCommandEvent &e);
DECLARE_EVENT_TABLE()
};
#endif
// File : appFrame.cpp
#include "appFrame.h"
wxDEFINE_EVENT(CEF_START_EVT, wxCommandEvent)
void appFrame::OnCefStartEvent(wxCommandEvent &e)
{
CefRunMessageLoop();
}
int appFrame::OnExit(){
CefShutdown();
Destroy();
return 0;
}
appFrame::appFrame(const wxString &title, const wxPoint &pos, const wxSize &size)
: wxFrame(NULL, wxID_ANY, title, pos, size)
{
}
wxBEGIN_EVENT_TABLE(appFrame, wxFrame)
EVT_COMMAND(wxID_ANY, CEF_START_EVT, appFrame::OnCefStartEvent)
wxEND_EVENT_TABLE()
当我构建make文件时,会出现以下错误:
../src/appFrame.cpp:4:15: error: expected constructor, destructor, or type conversion before ‘(’ token
../src/appFrame.cpp:24:2: error: expected constructor, destructor, or type conversion before ‘wxEventTableEntry
我认为问题与错误放置事件表宏有关
我想知道到底是什么问题以及如何解决它?在
wxDEFINE\u EVENT()
宏之后需要一个分号(对于几乎所有带有wx
前缀的宏,它们始终需要一个分号,这与没有前缀的传统宏不同)
与往常一样,有关此宏的使用示例,请参见。我已尝试过此操作,但错误仍然相同,没有任何更改