]> git.saurik.com Git - wxWidgets.git/commitdiff
allow wxDialog::ShowModal() after Show() (see #1416, #4658, #4664)
authorVadim Zeitlin <vadim@wxwidgets.org>
Sun, 22 Jun 2008 14:40:25 +0000 (14:40 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Sun, 22 Jun 2008 14:40:25 +0000 (14:40 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@54328 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

interface/dialog.h
src/gtk/dialog.cpp
src/msw/dialog.cpp
src/osx/carbon/dialog.cpp

index 431edf62b757e073c484dded912bafd7ab1d3744..3052b2e0e57fdc871638ecc7bde7ee3a5c9c8ff5 100644 (file)
@@ -553,8 +553,15 @@ public:
     bool Show(bool show);
 
     /**
-        Shows a modal dialog. Program flow does not return until the dialog has
-        been dismissed with EndModal().
+        Shows a modal dialog.
+
+        Program flow does not return until the dialog has been dismissed with
+        EndModal().
+
+        Notice that it is possible to call ShowModal() for a dialog which had
+        been previously shown with Show(), this allows to make an existing
+        modeless dialog modal. However ShowModal() can't be called twice
+        without intervening EndModal() calls.
 
         @return The value set with SetReturnCode().
 
index c61fbca5155360091dd7f6f8a0cb07f85969307b..dcdaec3cbe58352b707c382b4bd238959852d4c3 100644 (file)
@@ -99,7 +99,6 @@ void wxDialog::SetModal( bool WXUNUSED(flag) )
 int wxDialog::ShowModal()
 {
     wxASSERT_MSG( !IsModal(), "ShowModal() can't be called twice" );
-    wxASSERT_MSG( !IsShown(), "ShowModal() can't be called after Show()" );
 
     // release the mouse if it's currently captured as the window having it
     // will be disabled when this dialog is shown -- but will still keep the
index b0703f2291abe4ba1e3c537d633ce65a596f45c1..1b66274cc16b0364215816807f21935a469ee5a9 100644 (file)
@@ -283,8 +283,7 @@ void wxDialog::Raise()
 // show dialog modally
 int wxDialog::ShowModal()
 {
-    wxASSERT_MSG(!IsShown(),
-                 _T("ShowModal() can't be called for an already shown dialog"));
+    wxASSERT_MSG( !IsModal(), _T("ShowModal() can't be called twice") );
 
     m_endModalCalled = false;
 
index 19dbf02e88f6cf9c7a4c50fb837a8bedac2c3be5..7dffcc6db80b83b3d41ea02e09079a1249c5b13e 100644 (file)
@@ -169,7 +169,10 @@ int wxDialog::ShowModal()
     if ( !m_isModalStyle )
         SetModal(true);
 
-    Show(true);
+    if ( IsShown() )
+        DoShowModal();
+    else
+        Show(true);
 
     return GetReturnCode();
 }