From: Julian Smart Date: Sun, 12 May 2002 12:46:34 +0000 (+0000) Subject: Added recursive event handler pushing to fix context help problem. X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/b8b9d8a790b93e749cc886b4d63245de8cac74d2 Added recursive event handler pushing to fix context help problem. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@15530 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/src/common/cshelp.cpp b/src/common/cshelp.cpp index e2737d2ed1..2cc7626a4a 100644 --- a/src/common/cshelp.cpp +++ b/src/common/cshelp.cpp @@ -87,6 +87,23 @@ wxContextHelp::~wxContextHelp() EndContextHelp(); } +static void wxPushOrPopEventHandlers(wxContextHelp* help, wxWindow* win, bool push) +{ + if (push) + win->PushEventHandler(new wxContextHelpEvtHandler(help)); + else + win->PopEventHandler(); + + wxNode* node = win->GetChildren().First(); + while (node) + { + wxWindow* child = (wxWindow*) node->Data(); + wxPushOrPopEventHandlers(help, child, push); + + node = node->Next(); + } +} + // Begin 'context help mode' bool wxContextHelp::BeginContextHelp(wxWindow* win) { @@ -103,7 +120,10 @@ bool wxContextHelp::BeginContextHelp(wxWindow* win) // wxSetCursor(cursor); #endif - win->PushEventHandler(new wxContextHelpEvtHandler(this)); + m_status = FALSE; + +// win->PushEventHandler(new wxContextHelpEvtHandler(this)); + wxPushOrPopEventHandlers(this, win, TRUE); win->CaptureMouse(); @@ -111,7 +131,8 @@ bool wxContextHelp::BeginContextHelp(wxWindow* win) win->ReleaseMouse(); - win->PopEventHandler(TRUE); +// win->PopEventHandler(TRUE); + wxPushOrPopEventHandlers(this, win, FALSE); win->SetCursor(oldCursor); @@ -173,7 +194,8 @@ bool wxContextHelpEvtHandler::ProcessEvent(wxEvent& event) (event.GetEventType() == wxEVT_ACTIVATE) || (event.GetEventType() == wxEVT_MOUSE_CAPTURE_CHANGED)) { - m_contextHelp->SetStatus(FALSE); + // May have already been set to TRUE by a left-click + //m_contextHelp->SetStatus(FALSE); m_contextHelp->EndContextHelp(); return TRUE; }