From: Vadim Zeitlin Date: Thu, 22 Nov 2001 00:43:38 +0000 (+0000) Subject: minor flicker reduction in the virtual list ctrl X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/ad9f477da56634d82b6e26ee380dfa78dda52da0?ds=inline minor flicker reduction in the virtual list ctrl git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@12577 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/src/msw/listctrl.cpp b/src/msw/listctrl.cpp index bdab497417..be0e6c5bac 100644 --- a/src/msw/listctrl.cpp +++ b/src/msw/listctrl.cpp @@ -752,8 +752,9 @@ bool wxListCtrl::SetItemState(long item, long state, long stateMask) wxConvertToMSWFlags(state, stateMask, lvItem); // for the virtual list controls we need to refresh the previously focused - // item manually when changing focus programmatically because otherwise it - // keeps its focus rectangle until next repaint (yet another comctl32 bug) + // item manually when changing focus without changing selection + // programmatically because otherwise it keeps its focus rectangle until + // next repaint (yet another comctl32 bug) long focusOld; if ( IsVirtual() && (stateMask & wxLIST_STATE_FOCUSED) && @@ -776,7 +777,13 @@ bool wxListCtrl::SetItemState(long item, long state, long stateMask) if ( focusOld != -1 ) { - RefreshItem(focusOld); + // no need to refresh the item if it was previously selected, it would + // only result in annoying flicker + if ( !(GetItemState(focusOld, + wxLIST_STATE_SELECTED) & wxLIST_STATE_SELECTED) ) + { + RefreshItem(focusOld); + } } return TRUE;