]> git.saurik.com Git - wxWidgets.git/commitdiff
call event.Enable(true) in OnUpdateFileOpen and OnUpdateFileNew only if there are...
authorFrancesco Montorsi <f18m_cpp217828@yahoo.it>
Wed, 14 Jan 2009 15:25:05 +0000 (15:25 +0000)
committerFrancesco Montorsi <f18m_cpp217828@yahoo.it>
Wed, 14 Jan 2009 15:25:05 +0000 (15:25 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@58097 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/common/docview.cpp

index b9eac572333fd83a0d4bcc23ab264b13f63db156..ac7af5109a16d62ab28b6fd2570d8d97b75143a9 100644 (file)
@@ -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)