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;
}