From 952f8d3c7a729127bf73ba4f819cbadc51753e79 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Wed, 14 May 2008 00:53:16 +0000 Subject: [PATCH] delay gripper positioning until the dialog is shown to ensure that it doesn't overwrite other dialog children git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@53589 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/msw/dialog.cpp | 34 +++++++++++++++++++++++----------- 1 file changed, 23 insertions(+), 11 deletions(-) diff --git a/src/msw/dialog.cpp b/src/msw/dialog.cpp index 64d7f61bc6..0a923fccce 100644 --- a/src/msw/dialog.cpp +++ b/src/msw/dialog.cpp @@ -184,7 +184,7 @@ bool wxDialog::Create(wxWindow *parent, CreateToolBar(); #endif - if( HasFlag(wxRESIZE_BORDER) ) + if ( HasFlag(wxRESIZE_BORDER) ) CreateGripper(); return true; @@ -349,7 +349,7 @@ void wxDialog::SetWindowStyleFlag(long style) { wxDialogBase::SetWindowStyleFlag(style); - if( HasFlag(wxRESIZE_BORDER) ) + if ( HasFlag(wxRESIZE_BORDER) ) CreateGripper(); else DestroyGripper(); @@ -357,13 +357,15 @@ void wxDialog::SetWindowStyleFlag(long style) void wxDialog::CreateGripper() { - if( !m_hGripper ) + if ( !m_hGripper ) { + // just create it here, it will be positioned and shown later m_hGripper = (WXHWND)::CreateWindow ( wxT("SCROLLBAR"), wxT(""), - WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | + WS_CHILD | + WS_CLIPSIBLINGS | SBS_SIZEGRIP | SBS_SIZEBOX | SBS_SIZEBOXBOTTOMRIGHTALIGN, @@ -373,9 +375,6 @@ void wxDialog::CreateGripper() wxGetInstance(), NULL ); - - // position the gripper correctly after creation - ResizeGripper(); } } @@ -392,6 +391,9 @@ void wxDialog::ShowGripper(bool show) { wxASSERT_MSG( m_hGripper, _T("shouldn't be called if we have no gripper") ); + if ( show ) + ResizeGripper(); + ::ShowWindow((HWND)m_hGripper, show ? SW_SHOW : SW_HIDE); } @@ -501,10 +503,6 @@ WXLRESULT wxDialog::MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lPar case SIZE_RESTORED: ShowGripper(true); - // fall through - - default: - ResizeGripper(); } } @@ -522,6 +520,20 @@ WXLRESULT wxDialog::MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lPar } break; + case WM_WINDOWPOSCHANGED: + { + WINDOWPOS * const wp = wx_reinterpret_cast(WINDOWPOS *, lParam); + if ( wp->flags & SWP_SHOWWINDOW ) + { + // we should only show it now to ensure that it's really + // positioned underneath under all the other controls in + // the dialog, if we showed it before it could overlap them + if ( m_hGripper ) + ShowGripper(true); + } + } + break; + #ifndef __WXMICROWIN__ case WM_SETCURSOR: // we want to override the busy cursor for modal dialogs: -- 2.45.2