From: Vadim Zeitlin Date: Sat, 18 Sep 2004 11:03:24 +0000 (+0000) Subject: fixed SetWindowStyleFlag() to not remove WS_VISIBLE; also refresh the control automat... X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/6e2fef031b643ceda4ff4bd6f1920ecb20780c6e?ds=inline fixed SetWindowStyleFlag() to not remove WS_VISIBLE; also refresh the control automatically (closes bug 1019440) git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@29193 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/docs/changes.txt b/docs/changes.txt index ea21518896..b66f036525 100644 --- a/docs/changes.txt +++ b/docs/changes.txt @@ -278,6 +278,7 @@ wxMSW: - fixed wxMaximizeEvent generation in wxFrame - don't send duplicate EVT_COMBOBOX events whenever selection changes any more - implemented support for selecting printer bin (Steven Van Ingelgem) +- fixed wxListCtrl::SetSingleStyle() which was broken since a few releases wxUniv/X11: diff --git a/src/msw/listctrl.cpp b/src/msw/listctrl.cpp index cf1841b197..3c08663e15 100644 --- a/src/msw/listctrl.cpp +++ b/src/msw/listctrl.cpp @@ -447,9 +447,17 @@ void wxListCtrl::UpdateStyle() // The new window view style DWORD dwStyleNew = MSWGetStyle(m_windowStyle, NULL); + // some styles are not returned by MSWGetStyle() + if ( IsShown() ) + dwStyleNew |= WS_VISIBLE; + // Get the current window style. DWORD dwStyleOld = ::GetWindowLong(GetHwnd(), GWL_STYLE); + // we don't have wxVSCROLL style, but the list control may have it, + // don't change it then + dwStyleNew |= dwStyleOld & (WS_HSCROLL | WS_VSCROLL); + // Only set the window style if the view bits have changed. if ( dwStyleOld != dwStyleNew ) { @@ -510,30 +518,25 @@ void wxListCtrl::SetSingleStyle(long style, bool add) flag = flag & ~wxLC_MASK_SORT; } - if ( flag & style ) - { - if ( !add ) - flag -= style; - } + if ( add ) + flag |= style; else - { - if ( add ) - { - flag |= style; - } - } - - m_windowStyle = flag; + flag &= ~style; - UpdateStyle(); + SetWindowStyleFlag(flag); } // Set the whole window style void wxListCtrl::SetWindowStyleFlag(long flag) { - m_windowStyle = flag; + if ( flag != m_windowStyle ) + { + m_windowStyle = flag; + + UpdateStyle(); - UpdateStyle(); + Refresh(); + } } // ----------------------------------------------------------------------------