From 2596e9fb2c6f7c999cdf1ffaa62b043e1bb4ce1e Mon Sep 17 00:00:00 2001 From: =?utf8?q?V=C3=A1clav=20Slav=C3=ADk?= Date: Wed, 29 Sep 2004 21:07:48 +0000 Subject: [PATCH] fixed flicker during MDI children creation: the frame is now created hidden and shown in idle time to maintain backward compatibility git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@29549 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- include/wx/msw/mdi.h | 3 +++ src/msw/mdi.cpp | 20 ++++++++++++++++++-- 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/include/wx/msw/mdi.h b/include/wx/msw/mdi.h index a6fc56445b..04705e7aa9 100644 --- a/include/wx/msw/mdi.h +++ b/include/wx/msw/mdi.h @@ -174,6 +174,8 @@ public: bool ResetWindowStyle(void *vrect); void OnIdle(wxIdleEvent& event); + + virtual bool Show(bool show = true); protected: virtual void DoGetPosition(int *x, int *y) const; @@ -187,6 +189,7 @@ protected: void Init(); private: + bool m_needsInitialShow; // Show must be called in idle time after Creation bool m_needsResize; // flag which tells us to artificially resize the frame DECLARE_EVENT_TABLE() diff --git a/src/msw/mdi.cpp b/src/msw/mdi.cpp index 4bbb0a2b56..3d2ac43e30 100644 --- a/src/msw/mdi.cpp +++ b/src/msw/mdi.cpp @@ -670,6 +670,7 @@ bool wxMDIParentFrame::MSWTranslateMessage(WXMSG* msg) void wxMDIChildFrame::Init() { m_needsResize = true; + m_needsInitialShow = true; } bool wxMDIChildFrame::Create(wxMDIParentFrame *parent, @@ -681,7 +682,6 @@ bool wxMDIChildFrame::Create(wxMDIParentFrame *parent, const wxString& name) { SetName(name); - wxWindowBase::Show(true); // MDI child frame starts off shown if ( id != wxID_ANY ) m_windowId = id; @@ -725,7 +725,7 @@ bool wxMDIChildFrame::Create(wxMDIParentFrame *parent, else mcs.cy = CW_USEDEFAULT; - DWORD msflags = WS_OVERLAPPED | WS_CLIPCHILDREN | WS_VISIBLE ; + DWORD msflags = WS_OVERLAPPED | WS_CLIPCHILDREN; if (style & wxMINIMIZE_BOX) msflags |= WS_MINIMIZEBOX; if (style & wxMAXIMIZE_BOX) @@ -773,6 +773,12 @@ wxMDIChildFrame::~wxMDIChildFrame() MSWDestroyWindow(); } +bool wxMDIChildFrame::Show(bool show) +{ + m_needsInitialShow = false; + return wxFrame::Show(show); +} + // Set the client size (i.e. leave the calculation of borders etc. // to wxWidgets) void wxMDIChildFrame::DoSetClientSize(int width, int height) @@ -1303,6 +1309,16 @@ void wxMDIClientWindow::DoSetSize(int x, int y, int width, int height, int sizeF void wxMDIChildFrame::OnIdle(wxIdleEvent& event) { + // wxMSW prior to 2.5.3 created MDI child frames as visible, which resulted + // in flicker e.g. when the frame contained controls with non-trivial + // layout. Since 2.5.3, the frame is created hidden as all other top level + // windows. In order to maintain backward compatibility, the frame is shown + // in OnIdle, unless Show(false) was called by the programmer before. + if ( m_needsInitialShow ) + { + Show(true); + } + // MDI child frames get their WM_SIZE when they're constructed but at this // moment they don't have any children yet so all child windows will be // positioned incorrectly when they are added later - to fix this, we -- 2.45.2