Browse Source

Bug fix: Site lists stops working when import source is changed on Windows XP

Source commit: f57ca049e6735abb5a708c8d4abf503c2cd58dfb
Martin Prikryl 8 năm trước cách đây
mục cha
commit
f4be01068e
1 tập tin đã thay đổi với 6 bổ sung2 xóa
  1. 6 2
      source/windows/VCLCommon.cpp

+ 6 - 2
source/windows/VCLCommon.cpp

@@ -152,8 +152,8 @@ void __fastcall AutoSizeListColumnsWidth(TListView * ListView, int ColumnToShrin
         // Question is whether we should not shrink to min width instead.
         if ((ResizableWidth - ColumnToShrink->Width) < (Remaining - ColumnToShrinkMinWidth))
         {
-          ListView->Columns->Items[ColumnToShrinkIndex]->Width =
-            Remaining - (ResizableWidth - ListView->Columns->Items[ColumnToShrinkIndex]->Width);
+          int ColumnToShrinkWidth = Remaining - (ResizableWidth - ColumnToShrink->Width);
+          ColumnToShrink->Width = ColumnToShrinkWidth;
           ProportionalResize = false;
         }
       }
@@ -192,6 +192,10 @@ void __fastcall AutoSizeListColumnsWidth(TListView * ListView, int ColumnToShrin
   __finally
   {
     SendMessage(ListView->Handle, WM_SETREDRAW, true, 0);
+    // As recommended by documentation for WM_SETREDRAW.
+    // Without this, session list on Import dialog stops working after the list is reloaded while visible
+    // (i.e. when chaing import source)
+    RedrawWindow(ListView->Handle, NULL, NULL, RDW_ERASE | RDW_FRAME | RDW_INVALIDATE | RDW_ALLCHILDREN);
   }
 }
 //---------------------------------------------------------------------------