简体   繁体   中英

wxWidgets connect() not recognizing event type

I'm trying to connect a wxListCtrl event to a function in C++, and it should be straightforward. Generally using Connect() works, but for one reason or another, it isn't recognizing the event name (EVT_LIST_ITEM_SELECTED). I've included wx/listctrl.h, and even checked to make sure the event is listed (it is; not in listctrl, but in listbase which is included in listctrl).

Here is the problem line:

parent->Connect (ID_Objects, wxEVT_LIST_ITEM_SELECTED, (wxObjectEventFunction) &Editor::objectSelected);

The specific error is that identifier "wxEVT_LIST_ITEM_SELECTED" is undefined. The parent is a wxFrame.

In other places, I've used the same syntax but with a different event type and it worked fine.

So what am I doing wrong?

确保<wx/listctrl.h>包含在包含parent->Connect (ID_Objects, wxEVT_LIST_ITEM_SELECTED, ...的文件中parent->Connect (ID_Objects, wxEVT_LIST_ITEM_SELECTED, ...

尝试

wxEVT_COMMAND_LIST_ITEM_SELECTED

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM