错误:error: ISO C++ does not permit '€˜wxScrolledWindow::sm_eventTable' to be defined as 'MyClass::sm_eventTable'

错误内容:

 

error: ISO C++ does not permit '€˜wxScrolledWindow::sm_eventTable' to be defined as 'MyClass::sm_eventTable'

error: '€˜const wxEventTableEntry wxScrolledWindow::sm_eventTableEntries []'€™ is private

一般是在首次自行派生wxWidget的类,在处理EVENT_TABLE时产生

 

解决办法:

在派生类的定义块中,加上一行DECLARE_EVENT_TABLE()

示例如下:

 

[MyClass.h]


 

class MyClass : public wxScrolledWindow { public: MyClass(wxWindow* parent); virtual ~MyClass(); private: DECLARE_EVENT_TABLE() //加上此行定义 }; 

 

 

 

[MyClass.cpp]


 

BEGIN_EVENT_TABLE(MyClass, wxScrolledWindow) EVT_MIDDLE_DOWN(MyClass::OnMiddleDown) EVT_MIDDLE_UP(MyClass::OnMiddleUp) EVT_MOUSEWHEEL(MyClass::OnMouseWheel) EVT_MOTION(MyClass::OnMotion) EVT_RIGHT_DOWN(MyClass::OnRightDown) EVT_RIGHT_UP(MyClass::OnRightUp) END_EVENT_TABLE() MyClass::MyClass(wxWindow* parent) : wxScrolledWindow(parent, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxALWAYS_SHOW_SB | wxHSCROLL | wxVSCROLL) { //ctor } MyClass::~MyClass() { //dtor } 

 

 

 

你可能感兴趣的:(C++,c,table,Class,UP)