DEFINE_EVENT_TYPE obsolete?
DEFINE_EVENT_TYPE obsolete?
I am using wx from SVN. In event.h I can read that DEFINE_EVENT_TYPE is obsolete.
What can I use alternatively?
What can I use alternatively?
Hi,
As mentioned in the event overview in 2.9 you may/should use the wxDEFINE_EVENT() macro, which gives Bind() its type-safety.
Regards,
David
As mentioned in the event overview in 2.9 you may/should use the wxDEFINE_EVENT() macro, which gives Bind() its type-safety.
Regards,
David
Last edited by DavidHart on Sun Oct 10, 2010 3:20 pm, edited 1 time in total.
I see but didn't understand the difference. ;)
This is how I fire the event.
I tried
But of course it cause in this error message
because wxCommandEvent is still declared.
How can I solve that? I think I missinterpret the design rule behind it.
This is how I fire the event.
Code: Select all
BFMainFrame::Instance()->GetEventHandler()->AddPendingEvent(wxCommandEvent(BF_EVENT_THREAD_END, BF_ID_MAINFRAME));
Code: Select all
wxDEFINE_EVENT(BF_EVENT_THREAD_END, wxCommandEvent);
Code: Select all
1>d:\garage\projekte\blackfisk\trunk\src\bfthread_backuprunner.cpp(32) : error C2371: 'BF_EVENT_THREAD_END': Neudefinition; unterschiedliche Basistypen
How can I solve that? I think I missinterpret the design rule behind it.
It says
Code: Select all
new definition; different basic types
You probably left a DECLARE_EVENT_TYPE in a header file.
If you declare your event a way, and define it another way, you'll have this message. So if you need your event to be visible out of the scope of your cpp file, you'll have to define it in the header, using the 2.9 way (eg : wxDECLARE_EVENT instead of DECLARE_EVENT_TYPE) :
If you declare your event a way, and define it another way, you'll have this message. So if you need your event to be visible out of the scope of your cpp file, you'll have to define it in the header, using the 2.9 way (eg : wxDECLARE_EVENT instead of DECLARE_EVENT_TYPE) :
Code: Select all
// this is typically in a header: it just declares MY_EVENT event type
wxDECLARE_EVENT(MY_EVENT, wxCommandEvent);
// this is a definition so can't be in a header
wxDEFINE_EVENT(MY_EVENT, wxCommandEvent);
Jérémie
This was not mentioned in "Changes since 2.8"
This change was not mentioned on the page
http://docs.wxwidgets.org/2.9.1/overvie ... nce28.html
I have an existence proof that this change breaks the build potentially in eleven of my projects.
http://docs.wxwidgets.org/2.9.1/overvie ... nce28.html
I have an existence proof that this change breaks the build potentially in eleven of my projects.
Re: This was not mentioned in "Changes since 2.8"
this link is not a full list of changes, it is only an overview of new features. For the full list, see http://svn.wxwidgets.org/viewvc/wx/wxWi ... iew=markuprogue wrote:This change was not mentioned on the page
http://docs.wxwidgets.org/2.9.1/overvie ... nce28.html
I have an existence proof that this change breaks the build potentially in eleven of my projects.
"Keyboard not detected. Press F1 to continue"
-- Windows
-- Windows