X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/b8505921fcf3328fa86d79828a74fc46d62d438d..cfcc39321282c5877cbb45248bb8004ced24516b:/src/msw/msgdlg.cpp diff --git a/src/msw/msgdlg.cpp b/src/msw/msgdlg.cpp index ec05f72a37..af52a3d595 100644 --- a/src/msw/msgdlg.cpp +++ b/src/msw/msgdlg.cpp @@ -46,8 +46,7 @@ wxMessageDialog::wxMessageDialog(wxWindow *parent, int wxMessageDialog::ShowModal() { - wxWindow *winTop = wxTheApp->GetTopWindow(); - if ( !winTop ) + if ( !wxTheApp->GetTopWindow() ) { // when the message box is shown from wxApp::OnInit() (i.e. before the // message loop is entered), this must be done or the next message box @@ -58,11 +57,9 @@ int wxMessageDialog::ShowModal() } // use the top level window as parent if none specified - HWND hWnd = 0; - if ( m_parent ) - hWnd = GetHwndOf(m_parent); - else if ( winTop ) - hWnd = GetHwndOf(winTop); + if ( !m_parent ) + m_parent = FindSuitableParent(); + HWND hWnd = m_parent ? GetHwndOf(m_parent) : NULL; // translate wx style in MSW unsigned int msStyle = MB_OK; @@ -93,6 +90,9 @@ int wxMessageDialog::ShowModal() else if (m_dialogStyle & wxICON_QUESTION) msStyle |= MB_ICONQUESTION; + if ( m_dialogStyle & wxSTAY_ON_TOP ) + msStyle |= MB_TOPMOST; + if (hWnd) msStyle |= MB_APPLMODAL; else