From: Vadim Zeitlin Date: Thu, 22 Aug 2002 18:11:27 +0000 (+0000) Subject: fix for wxComboBox flicker on create (patch 598891) X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/bdf5c30deb87129df7fb8a1a782d2b20dba0a816 fix for wxComboBox flicker on create (patch 598891) git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@16685 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/src/msw/combobox.cpp b/src/msw/combobox.cpp index ceb2d59b8e..0e81ed856a 100644 --- a/src/msw/combobox.cpp +++ b/src/msw/combobox.cpp @@ -304,6 +304,11 @@ bool wxComboBox::Create(wxWindow *parent, wxWindowID id, const wxValidator& validator, const wxString& name) { + // pretend that wxComboBox is hidden while it is positioned and resized and + // show it only right before leaving this method because otherwise there is + // some noticeable flicker while the control rearranges itself + m_isShown = FALSE; + // first create wxWin object if ( !CreateControl(parent, id, pos, size, style, validator, name) ) return FALSE; @@ -360,6 +365,9 @@ bool wxComboBox::Create(wxWindow *parent, wxWindowID id, ); } + // and finally, show the control + Show(TRUE); + return TRUE; } diff --git a/src/msw/control.cpp b/src/msw/control.cpp index 930d7542ce..6593d6eed1 100644 --- a/src/msw/control.cpp +++ b/src/msw/control.cpp @@ -106,9 +106,14 @@ bool wxControl::MSWCreateControl(const wxChar *classname, exstyle = Determine3DEffects(WS_EX_CLIENTEDGE, &want3D); } - // all controls should have these styles (wxWindows creates all controls - // visible by default) - style |= WS_CHILD | WS_VISIBLE; + // all controls should have this style + style |= WS_CHILD; + + // create the control visible if it's currently shown for wxWindows + if ( m_isShown ) + { + style |= WS_VISIBLE; + } int x = pos.x == -1 ? 0 : pos.x, y = pos.y == -1 ? 0 : pos.y,