瀏覽代碼

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

Source commit: f57ca049e6735abb5a708c8d4abf503c2cd58dfb
Martin Prikryl 8 年之前
父節點
當前提交
f4be01068e
共有 1 個文件被更改,包括 6 次插入2 次删除
  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.
         // Question is whether we should not shrink to min width instead.
         if ((ResizableWidth - ColumnToShrink->Width) < (Remaining - ColumnToShrinkMinWidth))
         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;
           ProportionalResize = false;
         }
         }
       }
       }
@@ -192,6 +192,10 @@ void __fastcall AutoSizeListColumnsWidth(TListView * ListView, int ColumnToShrin
   __finally
   __finally
   {
   {
     SendMessage(ListView->Handle, WM_SETREDRAW, true, 0);
     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);
   }
   }
 }
 }
 //---------------------------------------------------------------------------
 //---------------------------------------------------------------------------