]> git.saurik.com Git - wxWidgets.git/blobdiff - src/msw/listctrl.cpp
fixes for handling WM_SYSCOLORCHANGE - now seems to work
[wxWidgets.git] / src / msw / listctrl.cpp
index bdab497417cd78cb47a104aee087da37a449075d..be0e6c5bacb2f592c436a24f079283ae96f06893 100644 (file)
@@ -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;