ソースを参照

Bug 1663: File panel columns do not have a width constraints

https://winscp.net/tracker/1663
(cherry picked from commit 616f3da36f31de92b3a63b55393721094ec244fb)

Source commit: 6c55edea9320c99149e7ba2e48d3fb30de426d3f
Martin Prikryl 7 年 前
コミット
02dc87d928
1 ファイル変更31 行追加29 行削除
  1. 31 29
      source/packages/my/ListViewColProperties.pas

+ 31 - 29
source/packages/my/ListViewColProperties.pas

@@ -549,42 +549,42 @@ begin
       CreateProperties(Columns.Count);
 
     UpdateFromListView;
+  end
+    else
+  begin
+    UpdateListView;
+  end;
 
-    if not FConstraintsInitialized then
+  if not FConstraintsInitialized then
+  begin
+    FConstraintsInitialized := True;
+
+    for Index := 0 to Count - 1 do
     begin
-      FConstraintsInitialized := True;
+      Column := GetColumn(Index);
+      Properties := GetProperties(Index);
 
-      for Index := 0 to Count - 1 do
+      // Is this branching needed?
+      if Properties.Visible then
       begin
-        Column := GetColumn(Index);
-        Properties := GetProperties(Index);
-
-        // Is this branching needed?
-        if Properties.Visible then
-        begin
-          W := Column.MaxWidth;
-          if W = 0 then W := DefaultListViewMaxWidth;
-          Properties.MaxWidth := ScaleByTextHeight(FListView, W);
-
-          W := Column.MinWidth;
-          if W = 0 then W := DefaultListViewMinWidth;
-          Properties.MinWidth := ScaleByTextHeight(FListView, W);
-        end
-          else
-        begin
-          Column.MaxWidth := ScaleByTextHeight(FListView, Column.MaxWidth);
-          Column.MinWidth := ScaleByTextHeight(FListView, Column.MinWidth);
-        end;
+        W := Column.MaxWidth;
+        if W = 0 then W := DefaultListViewMaxWidth;
+        Properties.MaxWidth := ScaleByTextHeight(FListView, W);
+
+        W := Column.MinWidth;
+        if W = 0 then W := DefaultListViewMinWidth;
+        Properties.MinWidth := ScaleByTextHeight(FListView, W);
+      end
+        else
+      begin
+        Column.MaxWidth := ScaleByTextHeight(FListView, Column.MaxWidth);
+        Column.MinWidth := ScaleByTextHeight(FListView, Column.MinWidth);
       end;
     end;
-
-    // To apply the default constraints to columns that do not have their own
-    UpdateListViewMaxMinWidth;
-  end
-    else
-  begin
-    UpdateListView;
   end;
+
+  // To apply the default constraints to columns that do not have their own
+  UpdateListViewMaxMinWidth;
 end;
 
 procedure TCustomListViewColProperties.ListViewWndDestroying;
@@ -633,7 +633,9 @@ begin
     if Properties.Visible then
     begin
       Column.MaxWidth := Properties.MaxWidth;
+      if Column.Width > Column.MaxWidth then Column.Width := Column.MaxWidth;
       Column.MinWidth := Properties.MinWidth;
+      if Column.Width < Column.MinWidth then Column.Width := Column.MinWidth;
     end;
   end;
 end;