]> git.saurik.com Git - wxWidgets.git/commitdiff
Use event tables instead of Bind() in uiaction sample.
authorVadim Zeitlin <vadim@wxwidgets.org>
Sat, 13 Mar 2010 21:58:04 +0000 (21:58 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Sat, 13 Mar 2010 21:58:04 +0000 (21:58 +0000)
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

samples/uiaction/uiaction.cpp

index a9eeb435191e663fd9f50f564edde471a6600f6b..86a6729d4057d0cc5991129853deb84e4f4d9110 100644 (file)
     #include "../sample.xpm"
 #endif
 
     #include "../sample.xpm"
 #endif
 
+// ----------------------------------------------------------------------------
+// constants
+// ----------------------------------------------------------------------------
+
+// IDs for the controls and the menu commands
+enum
+{
+    // menu items
+    TheButton = 100,
+    RunSimulation
+};
+
 // ----------------------------------------------------------------------------
 // private classes
 // ----------------------------------------------------------------------------
 // ----------------------------------------------------------------------------
 // private classes
 // ----------------------------------------------------------------------------
@@ -69,21 +81,14 @@ public:
 private:
     bool m_buttonPressed;
     bool m_menuSelected;
 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
 
 // ============================================================================
 // implementation
@@ -93,6 +98,8 @@ IMPLEMENT_APP(MyApp)
 // the application class
 // ----------------------------------------------------------------------------
 
 // the application class
 // ----------------------------------------------------------------------------
 
+IMPLEMENT_APP(MyApp)
+
 bool MyApp::OnInit()
 {
     if ( !wxApp::OnInit() )
 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");
 
     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);
 }
 
 
 }