+void MyFrame::OnModalHook(wxCommandEvent& event)
+{
+ class TestModalHook : public wxModalDialogHook
+ {
+ protected:
+ virtual int Enter(wxDialog* dialog)
+ {
+ wxLogStatus("Showing %s modal dialog",
+ dialog->GetClassInfo()->GetClassName());
+ return wxID_NONE;
+ }
+
+ virtual void Exit(wxDialog* dialog)
+ {
+ wxLogStatus("Leaving %s modal dialog",
+ dialog->GetClassInfo()->GetClassName());
+ }
+ };
+
+ static TestModalHook s_hook;
+ if ( event.IsChecked() )
+ s_hook.Register();
+ else
+ s_hook.Unregister();
+}
+