From 924d65ee97299840bc692722cae5ae8ff0cc8042 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Fri, 13 Jun 2008 22:38:33 +0000 Subject: [PATCH] don't clear the list control when wxLC_[HV]RULES style is toggled (#4688) git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_8_BRANCH@54201 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- docs/changes.txt | 1 + src/generic/listctrl.cpp | 12 +++++++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/docs/changes.txt b/docs/changes.txt index b7f0a31924..5bde916950 100644 --- a/docs/changes.txt +++ b/docs/changes.txt @@ -135,6 +135,7 @@ All (GUI): - Fixed incorrect layout width caching in wxHTML (Jeff Tupper). - wxHTML: preserve TAB characters when copying
 content to clipboard.
 - Set focus to wxCalendarCtrl when it is clicked.
+- Don't clear the list control when wxLC_[HV]RULES style is toggled.
 
 All (Unix):
 
diff --git a/src/generic/listctrl.cpp b/src/generic/listctrl.cpp
index e238cfe8f9..060a54398d 100644
--- a/src/generic/listctrl.cpp
+++ b/src/generic/listctrl.cpp
@@ -5123,7 +5123,17 @@ void wxGenericListCtrl::SetSingleStyle( long style, bool add )
     else
         flag &= ~style;
 
-    SetWindowStyleFlag( flag );
+    // some styles can be set without recreating everything (as happens in
+    // SetWindowStyleFlag() which calls wxListMainWindow::DeleteEverything())
+    if ( !(style & ~(wxLC_HRULES | wxLC_VRULES)) )
+    {
+        Refresh();
+        wxWindow::SetWindowStyleFlag(flag);
+    }
+    else
+    {
+        SetWindowStyleFlag( flag );
+    }
 }
 
 void wxGenericListCtrl::SetWindowStyleFlag( long flag )