lmi-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[lmi-commits] [5996] Close "Help | About" dialog if initially open


From: Greg Chicares
Subject: [lmi-commits] [5996] Close "Help | About" dialog if initially open
Date: Sat, 25 Oct 2014 15:06:17 +0000

Revision: 5996
          http://svn.sv.gnu.org/viewvc/?view=rev&root=lmi&revision=5996
Author:   chicares
Date:     2014-10-25 15:06:16 +0000 (Sat, 25 Oct 2014)
Log Message:
-----------
Close "Help | About" dialog if initially open

Modified Paths:
--------------
    lmi/trunk/ChangeLog
    lmi/trunk/main_wx_test.cpp

Modified: lmi/trunk/ChangeLog
===================================================================
--- lmi/trunk/ChangeLog 2014-10-25 14:42:26 UTC (rev 5995)
+++ lmi/trunk/ChangeLog 2014-10-25 15:06:16 UTC (rev 5996)
@@ -34379,3 +34379,9 @@
   wx_test_validate_output.cpp     [new file]
 Augment automated GUI test.
 
+20141025T1506Z <address@hidden> [533]
+
+  main_wx_test.cpp
+Close "Help | About" dialog if initially open. See:
+  http://lists.nongnu.org/archive/html/lmi/2014-10/msg00059.html
+

Modified: lmi/trunk/main_wx_test.cpp
===================================================================
--- lmi/trunk/main_wx_test.cpp  2014-10-25 14:42:26 UTC (rev 5995)
+++ lmi/trunk/main_wx_test.cpp  2014-10-25 15:06:16 UTC (rev 5996)
@@ -41,6 +41,7 @@
 #include <wx/frame.h>
 #include <wx/init.h>                    // wxEntry()
 #include <wx/stopwatch.h>
+#include <wx/uiaction.h>
 #include <wx/wfstream.h>
 
 #include <boost/scoped_ptr.hpp>
@@ -539,9 +540,32 @@
             return wxLogWindow::OnFrameClose(frame);
         }
     };
-    LogWindow* const log = new LogWindow();
 
     wxWindow* const mainWin = GetTopWindow();
+
+    // Close any initially opened dialogs (e.g. "About" dialog shown unless a
+    // special command line option is specified).
+    for (;;)
+        {
+        wxWindow* const activeWin = wxGetActiveWindow();
+        if (!activeWin || activeWin == mainWin)
+            break;
+
+        // Try to close the dialog.
+        wxUIActionSimulator ui;
+        ui.Char(WXK_ESCAPE);
+        wxYield();
+
+        // But stop trying if it didn't work.
+        if (wxGetActiveWindow() == activeWin)
+            {
+            wxLogError("Failed to close the currently opened window, "
+                       "please ensure it doesn't appear on program startup.");
+            return;
+            }
+        }
+
+    LogWindow* const log = new LogWindow();
     mainWin->SetFocus();
 
     wxStopWatch sw;




reply via email to

[Prev in Thread] Current Thread [Next in Thread]