]> git.saurik.com Git - wxWidgets.git/blobdiff - src/msw/msgdlg.cpp
Add new clipboard api and support for it in the ie backend. Also extend the sample...
[wxWidgets.git] / src / msw / msgdlg.cpp
index 8ea5e5e5f01dd722777c5be060e91e3e7f7391e6..2334638d8294480e4f9bb01f7cff302c8445cffa 100644 (file)
@@ -253,8 +253,10 @@ void wxMessageDialog::ReplaceStaticWithEdit()
     {
         if ( *i != '\n' )
         {
-            // found last non-newline char, remove everything after it and stop
-            text.erase(i.base() + 1, text.end());
+            // found last non-newline char, remove anything after it if
+            // necessary and stop in any case
+            if ( i != text.rbegin() )
+                text.erase(i.base() + 1, text.end());
             break;
         }
     }
@@ -719,16 +721,29 @@ void wxMSWTaskDialogConfig::MSWCommonTaskDialogInit(TASKDIALOGCONFIG &tdc)
     }
     else // without Yes/No we're going to have an OK button
     {
-        AddTaskDialogButton(tdc, IDOK, TDCBF_OK_BUTTON, btnOKLabel);
-
         if ( style & wxCANCEL )
         {
+            AddTaskDialogButton(tdc, IDOK, TDCBF_OK_BUTTON, btnOKLabel);
             AddTaskDialogButton(tdc, IDCANCEL,
                                 TDCBF_CANCEL_BUTTON, btnCancelLabel);
 
             if ( style & wxCANCEL_DEFAULT )
                 tdc.nDefaultButton = IDCANCEL;
         }
+        else // Only "OK"
+        {
+            // We actually create a "Cancel" button instead because we want to
+            // allow closing the dialog box with Escape (and also Alt-F4 or
+            // clicking the close button in the title bar) which wouldn't work
+            // without a Cancel button.
+            if ( !useCustomLabels )
+            {
+                useCustomLabels = true;
+                btnOKLabel = _("OK");
+            }
+
+            AddTaskDialogButton(tdc, IDCANCEL, TDCBF_CANCEL_BUTTON, btnOKLabel);
+        }
     }
 }