]> git.saurik.com Git - wxWidgets.git/commitdiff
Remember last values used in exec sample "Kill" menu item dialogs.
authorVadim Zeitlin <vadim@wxwidgets.org>
Thu, 9 Sep 2010 21:49:25 +0000 (21:49 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Thu, 9 Sep 2010 21:49:25 +0000 (21:49 +0000)
Remember the PID entered in the dialog and also remember the last used signal
number. This makes these dialogs slightly less painful to use when testing
even though ideally we'd have a single dialog for choosing both values instead
of two consecutive modal dialogs.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@65492 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

samples/exec/exec.cpp

index d5c0e4f1816055817d3de7e72ec2bd8528ab884a..fcbe8b302937394bfa05e72cbfacc6eb7d5d49f0 100644 (file)
@@ -571,6 +571,8 @@ void MyFrame::OnKill(wxCommandEvent& WXUNUSED(event))
         return;
     }
 
+    m_pidLast = pid;
+
     static const wxString signalNames[] =
     {
         wxT("Just test (SIGNONE)"),
@@ -591,9 +593,11 @@ void MyFrame::OnKill(wxCommandEvent& WXUNUSED(event))
         wxT("Terminate (SIGTERM)"),
     };
 
+    static int s_sigLast = wxSIGNONE;
     int sig = wxGetSingleChoiceIndex(wxT("How to kill the process?"),
                                      wxT("Exec question"),
                                      WXSIZEOF(signalNames), signalNames,
+                                     s_sigLast,
                                      this);
     switch ( sig )
     {
@@ -624,8 +628,11 @@ void MyFrame::OnKill(wxCommandEvent& WXUNUSED(event))
             break;
     }
 
-    if ( sig == 0 )
+    s_sigLast = sig;
+
+    if ( sig == wxSIGNONE )
     {
+        // This simply calls Kill(wxSIGNONE) but using it is more convenient.
         if ( wxProcess::Exists(pid) )
         {
             wxLogStatus(wxT("Process %ld is running."), pid);