-#if defined(__GNUG__) && !defined(__APPLE__)
- // DO NOT use event.cpp here, it breaks statics initialization in
- // src/common/event.cpp and nothing works at all then!
- #pragma implementation "eventsample.cpp"
- #pragma interface "eventsample.cpp"
-#endif
-
// it may also be convenient to define an event table macro for this event type
#define EVT_MY_CUSTOM_COMMAND(id, fn) \
DECLARE_EVENT_TABLE_ENTRY( \
// it may also be convenient to define an event table macro for this event type
#define EVT_MY_CUSTOM_COMMAND(id, fn) \
DECLARE_EVENT_TABLE_ENTRY( \
- wxEVT_MY_CUSTOM_COMMAND, id, -1, \
+ wxEVT_MY_CUSTOM_COMMAND, id, wxID_ANY, \
- // this would also work:
- //EVT_CUSTOM(wxEVT_MY_CUSTOM_COMMAND, -1, MyFrame::OnProcessCustom)
+ // the line below would also work if OnProcessCustom() were defined as
+ // taking a wxEvent (as required by EVT_CUSTOM) and not wxCommandEvent
+ //EVT_CUSTOM(wxEVT_MY_CUSTOM_COMMAND, wxID_ANY, MyFrame::OnProcessCustom)
// create the main application window
MyFrame *frame = new MyFrame(_T("Event wxWidgets Sample"),
wxPoint(50, 50), wxSize(600, 340));
// and show it (the frames, unlike simple controls, are not shown when
// created initially)
// create the main application window
MyFrame *frame = new MyFrame(_T("Event wxWidgets Sample"),
wxPoint(50, 50), wxSize(600, 340));
// and show it (the frames, unlike simple controls, are not shown when
// created initially)
- : wxFrame((wxFrame *)NULL, -1, title, pos, size)
+ : wxFrame((wxFrame *)NULL, wxID_ANY, title, pos, size)
wxMenu *menuEvent = new wxMenu;
menuEvent->Append(Event_Connect, _T("&Connect\tCtrl-C"),
_T("Connect or disconnect the dynamic event handler"),
wxMenu *menuEvent = new wxMenu;
menuEvent->Append(Event_Connect, _T("&Connect\tCtrl-C"),
_T("Connect or disconnect the dynamic event handler"),
menuEvent->Append(Event_Dynamic, _T("&Dynamic event\tCtrl-D"),
_T("Dynamic event sample - only works after Connect"));
menuEvent->AppendSeparator();
menuEvent->Append(Event_Dynamic, _T("&Dynamic event\tCtrl-D"),
_T("Dynamic event sample - only works after Connect"));
menuEvent->AppendSeparator();
}
void MyFrame::OnAbout(wxCommandEvent& WXUNUSED(event))
{
wxMessageBox( wxT("Event sample shows different ways of using events\n")
}
void MyFrame::OnAbout(wxCommandEvent& WXUNUSED(event))
{
wxMessageBox( wxT("Event sample shows different ways of using events\n")
- Connect(Event_Dynamic, -1, wxEVT_COMMAND_MENU_SELECTED,
+ Connect(Event_Dynamic, wxID_ANY, wxEVT_COMMAND_MENU_SELECTED,
SetStatusText(_T("You can now use \"Dynamic\" item in the menu"));
SetStatusText(_T("Dynamic: on"), Status_Dynamic);
SetStatusText(_T("You can now use \"Dynamic\" item in the menu"));
SetStatusText(_T("Dynamic: on"), Status_Dynamic);
SetStatusText(_T("You can no more use \"Dynamic\" item in the menu"));
SetStatusText(_T("Dynamic: off"), Status_Dynamic);
SetStatusText(_T("You can no more use \"Dynamic\" item in the menu"));
SetStatusText(_T("Dynamic: off"), Status_Dynamic);
}
void MyFrame::OnPopEventHandler(wxCommandEvent& WXUNUSED(event))
{
wxCHECK_RET( m_nPush, _T("this command should be disabled!") );
}
void MyFrame::OnPopEventHandler(wxCommandEvent& WXUNUSED(event))
{
wxCHECK_RET( m_nPush, _T("this command should be disabled!") );