From: Julian Smart Date: Thu, 22 Aug 2002 09:41:05 +0000 (+0000) Subject: Applied patch [ 598016 ] remove flicker during combo box creation X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/c832ef4985a506330691e11ac13240355ed7195b?ds=sidebyside Applied patch [ 598016 ] remove flicker during combo box creation By Benjamin I. Williams (biwillia76) The attached patch completely fixes the flicker problem when creating combo boxes. It also will make it elementary to remove flicker during the creation of other controls (although all the other controls are flicker free, AFAIK). It does this by adding an optional 'visible' parameter to the internal MSWCreateControl method, whereby the caller can create a control invisibly by default, perform some complicated sizing calculations, and then finally show the control before the Create finished. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@16676 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/distrib/msw/generic.rsp b/distrib/msw/generic.rsp index 1d0ecd155f..7e61bcc925 100644 --- a/distrib/msw/generic.rsp +++ b/distrib/msw/generic.rsp @@ -32,6 +32,7 @@ distrib/gtk/* locale/*.po locale/*.mo +locale/Makefile art/*.xpm art/motif/*.xpm diff --git a/distrib/msw/zipdistinno.bat b/distrib/msw/zipdistinno.bat index 8e7fc0a265..e0b638342a 100755 --- a/distrib/msw/zipdistinno.bat +++ b/distrib/msw/zipdistinno.bat @@ -239,7 +239,11 @@ erase /Y distrib rem Now copy some binary files to 'bin' if not isdir bin mkdir bin copy %src\bin\dialoged.exe bin +copy %src\bin\dialoged.hlp bin +copy %src\bin\dialoged.chm bin copy %src\bin\tex2rtf.exe bin +copy %src\bin\tex2rtf.hlp bin +copy %src\bin\tex2rtf.cnt bin copy %src\bin\dbgview.* bin copy %src\bin\widgets.exe bin copy %src\bin\widgets.exe.manifest bin diff --git a/include/wx/msw/control.h b/include/wx/msw/control.h index e5e7f5c918..3dde9eef15 100644 --- a/include/wx/msw/control.h +++ b/include/wx/msw/control.h @@ -92,12 +92,15 @@ protected: virtual wxSize DoGetBestSize() const; + // create the control of the given Window class bool MSWCreateControl(const wxChar *classname, const wxString& label, const wxPoint& pos, const wxSize& size, - long style); + long style, + bool visible = true); + // NB: the method below is deprecated now, with MSWGetStyle() the method // above should be used instead! Once all the controls are updated to @@ -117,7 +120,8 @@ protected: const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, const wxString& label = wxEmptyString, - WXDWORD exstyle = (WXDWORD)-1); + WXDWORD exstyle = (WXDWORD)-1, + bool visible = true); // default style for the control include WS_TABSTOP if it AcceptsFocus() virtual WXDWORD MSWGetStyle(long style, WXDWORD *exstyle) const; diff --git a/src/msw/combobox.cpp b/src/msw/combobox.cpp index ceb2d59b8e..7b65a4701d 100644 --- a/src/msw/combobox.cpp +++ b/src/msw/combobox.cpp @@ -326,7 +326,7 @@ bool wxComboBox::Create(wxWindow *parent, wxWindowID id, // and now create the MSW control - if ( !MSWCreateControl(_T("COMBOBOX"), msStyle) ) + if ( !MSWCreateControl(_T("COMBOBOX"), msStyle, pos, size, wxEmptyString, (WXDWORD)-1, false) ) return FALSE; // A choice/combobox normally has a white background (or other, depending @@ -360,6 +360,9 @@ bool wxComboBox::Create(wxWindow *parent, wxWindowID id, ); } + // finally, show the combo box + Show(true); + return TRUE; } diff --git a/src/msw/control.cpp b/src/msw/control.cpp index 930d7542ce..1beeb2b8d2 100644 --- a/src/msw/control.cpp +++ b/src/msw/control.cpp @@ -79,12 +79,13 @@ bool wxControl::MSWCreateControl(const wxChar *classname, const wxString& label, const wxPoint& pos, const wxSize& size, - long style) + long style, + bool visible) { WXDWORD exstyle; WXDWORD msStyle = MSWGetStyle(style, &exstyle); - return MSWCreateControl(classname, msStyle, pos, size, label, exstyle); + return MSWCreateControl(classname, msStyle, pos, size, label, exstyle, visible); } bool wxControl::MSWCreateControl(const wxChar *classname, @@ -92,7 +93,8 @@ bool wxControl::MSWCreateControl(const wxChar *classname, const wxPoint& pos, const wxSize& size, const wxString& label, - WXDWORD exstyle) + WXDWORD exstyle, + bool visible) { // want3D tells us whether or not the style specified a 3D border. // If so, under WIN16 we can use Ctl3D to give it an appropriate style. @@ -108,7 +110,18 @@ bool wxControl::MSWCreateControl(const wxChar *classname, // all controls should have these styles (wxWindows creates all controls // visible by default) - style |= WS_CHILD | WS_VISIBLE; + style |= WS_CHILD; + + // sometimes, controls will defer showing the window until + // all configuration, sizing, and positioning is completed + if (!visible) + { + m_isShown = FALSE; + } + else + { + style |= WS_VISIBLE; + } int x = pos.x == -1 ? 0 : pos.x, y = pos.y == -1 ? 0 : pos.y,