From 20c81bed846981e90769826b94a91eebb91158f1 Mon Sep 17 00:00:00 2001 From: Julian Smart Date: Fri, 2 Mar 2007 19:48:43 +0000 Subject: [PATCH] Fixed premature exit of helpview sample and utility git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@44600 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- include/wx/html/helpfrm.h | 2 +- samples/html/helpview/helpview.cpp | 2 ++ src/html/helpfrm.cpp | 8 ++++++++ utils/helpview/src/helpview.cpp | 2 ++ 4 files changed, 13 insertions(+), 1 deletion(-) diff --git a/include/wx/html/helpfrm.h b/include/wx/html/helpfrm.h index cc50b5fc57..4c53f11e40 100644 --- a/include/wx/html/helpfrm.h +++ b/include/wx/html/helpfrm.h @@ -109,7 +109,7 @@ public: // we don't want to prevent the app from closing just because a help window // remains opened - virtual bool ShouldPreventAppExit() const { return false; } + virtual bool ShouldPreventAppExit() const; protected: void Init(wxHtmlHelpData* data = NULL); diff --git a/samples/html/helpview/helpview.cpp b/samples/html/helpview/helpview.cpp index 3cb2b9bc4d..238deea26a 100644 --- a/samples/html/helpview/helpview.cpp +++ b/samples/html/helpview/helpview.cpp @@ -84,6 +84,8 @@ bool MyApp::OnInit() help -> DisplayContents(); + SetTopWindow(help->GetFrame()); + return true; } diff --git a/src/html/helpfrm.cpp b/src/html/helpfrm.cpp index c3a082efb9..7066746015 100644 --- a/src/html/helpfrm.cpp +++ b/src/html/helpfrm.cpp @@ -55,6 +55,7 @@ #include "wx/fontenum.h" #include "wx/artprov.h" #include "wx/spinctrl.h" +#include "wx/app.h" IMPLEMENT_DYNAMIC_CLASS(wxHtmlHelpFrame, wxFrame) @@ -237,4 +238,11 @@ void wxHtmlHelpFrame::OnAbout(wxCommandEvent& event) } #endif +// we don't want to prevent the app from closing just because a help window +// remains opened +bool wxHtmlHelpFrame::ShouldPreventAppExit() const +{ + return (this == wxTheApp->GetTopWindow()); +} + #endif // wxUSE_WXHTML_HELP diff --git a/utils/helpview/src/helpview.cpp b/utils/helpview/src/helpview.cpp index 72b3daa6a3..68991f7467 100644 --- a/utils/helpview/src/helpview.cpp +++ b/utils/helpview/src/helpview.cpp @@ -219,6 +219,8 @@ bool hvApp::OnInit() m_helpController->DisplayContents(); + SetTopWindow(m_helpController->GetFrame()); + return true; } -- 2.45.2