From 84cae69a8b6530450d37bd25e5190e8f963750bb Mon Sep 17 00:00:00 2001 From: Francesco Montorsi Date: Wed, 14 Jan 2009 15:25:05 +0000 Subject: [PATCH] call event.Enable(true) in OnUpdateFileOpen and OnUpdateFileNew only if there are templates in the doc manager (closes #10163) git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@58097 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/common/docview.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/common/docview.cpp b/src/common/docview.cpp index b9eac57233..ac7af5109a 100644 --- a/src/common/docview.cpp +++ b/src/common/docview.cpp @@ -1070,7 +1070,9 @@ void wxDocManager::OnRedo(wxCommandEvent& event) void wxDocManager::OnUpdateFileOpen(wxUpdateUIEvent& event) { - event.Enable( true ); + // CreateDocument() (which is called from OnFileOpen) may succeed + // only when there is at least a template: + event.Enable( GetTemplates().GetCount()>0 ); } void wxDocManager::OnUpdateDisableIfNoDoc(wxUpdateUIEvent& event) @@ -1080,7 +1082,9 @@ void wxDocManager::OnUpdateDisableIfNoDoc(wxUpdateUIEvent& event) void wxDocManager::OnUpdateFileNew(wxUpdateUIEvent& event) { - event.Enable( true ); + // CreateDocument() (which is called from OnFileNew) may succeed + // only when there is at least a template: + event.Enable( GetTemplates().GetCount()>0 ); } void wxDocManager::OnUpdateFileSave(wxUpdateUIEvent& event) -- 2.45.2