From: Vadim Zeitlin Date: Sat, 13 Mar 2010 21:58:04 +0000 (+0000) Subject: Use event tables instead of Bind() in uiaction sample. X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/d9ffb9fdccbdd9c919fff07a06880a48e1211a51 Use event tables instead of Bind() in uiaction sample. This should fix VC6 build broken by addition of this sample as VC6 doesn't support Bind(). Luckily, there is no need to use it here anyhow. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@63680 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/samples/uiaction/uiaction.cpp b/samples/uiaction/uiaction.cpp index a9eeb43519..86a6729d40 100644 --- a/samples/uiaction/uiaction.cpp +++ b/samples/uiaction/uiaction.cpp @@ -42,6 +42,18 @@ #include "../sample.xpm" #endif +// ---------------------------------------------------------------------------- +// constants +// ---------------------------------------------------------------------------- + +// IDs for the controls and the menu commands +enum +{ + // menu items + TheButton = 100, + RunSimulation +}; + // ---------------------------------------------------------------------------- // private classes // ---------------------------------------------------------------------------- @@ -69,21 +81,14 @@ public: private: bool m_buttonPressed; bool m_menuSelected; -}; -// ---------------------------------------------------------------------------- -// constants -// ---------------------------------------------------------------------------- - -// IDs for the controls and the menu commands -enum -{ - // menu items - TheButton = wxID_ANY, - RunSimulation = wxID_ANY + DECLARE_EVENT_TABLE() }; -IMPLEMENT_APP(MyApp) +BEGIN_EVENT_TABLE(MyFrame, wxFrame) + EVT_BUTTON(TheButton, MyFrame::OnButtonPressed) + EVT_MENU(RunSimulation, MyFrame::OnRunSimulation) +END_EVENT_TABLE() // ============================================================================ // implementation @@ -93,6 +98,8 @@ IMPLEMENT_APP(MyApp) // the application class // ---------------------------------------------------------------------------- +IMPLEMENT_APP(MyApp) + bool MyApp::OnInit() { if ( !wxApp::OnInit() ) @@ -134,8 +141,6 @@ MyFrame::MyFrame(const wxString& title) wxButton* button = new wxButton(this, TheButton, "Button"); button->SetName("TheButton"); - Bind(wxEVT_COMMAND_BUTTON_CLICKED, &MyFrame::OnButtonPressed, this, button->GetId()); - Bind(wxEVT_COMMAND_MENU_SELECTED, &MyFrame::OnRunSimulation, this, RunSimulation); }