-#if wxUSE_STATUSBAR
- SetStatusText(_T("You can no more use \"Dynamic\" item in the menu"));
- SetStatusText(_T("Dynamic: off"), Status_Dynamic);
-#endif // wxUSE_STATUSBAR
+ UpdateDynamicStatus(event.IsChecked());
+}
+
+#endif // !wxEVENTS_COMPATIBILITY_2_8
+
+void MyFrame::OnConnect(wxCommandEvent& event)
+{
+ if ( event.IsChecked() )
+ {
+ m_btnDynamic->Connect(wxID_ANY, wxEVT_COMMAND_BUTTON_CLICKED,
+ wxCommandEventHandler(MyFrame::OnDynamic),
+ NULL, this);
+ Connect(Event_Dynamic, wxEVT_COMMAND_MENU_SELECTED,
+ wxCommandEventHandler(MyFrame::OnDynamic));
+ }
+ else // disconnect
+ {
+ m_btnDynamic->Disconnect(wxID_ANY, wxEVT_COMMAND_BUTTON_CLICKED,
+ wxCommandEventHandler(MyFrame::OnDynamic),
+ NULL, this);
+ Disconnect(Event_Dynamic, wxEVT_COMMAND_MENU_SELECTED,
+ wxCommandEventHandler(MyFrame::OnDynamic));