ListViewColProperties.pas 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714
  1. unit ListViewColProperties;
  2. interface
  3. uses
  4. Classes, ComCtrls, Contnrs;
  5. type
  6. TCustomListViewColProperty = class(TObject)
  7. Alignment: TAlignment;
  8. Caption: string;
  9. Width: Integer;
  10. MaxWidth: Integer;
  11. MinWidth: Integer;
  12. Visible: Boolean;
  13. Order: Integer;
  14. constructor Create(AOrder: Integer);
  15. end;
  16. type
  17. TCustomListViewColProperties = class(TPersistent)
  18. private
  19. FChanged: Boolean;
  20. FOnChange: TNotifyEvent;
  21. FUpdating: Integer;
  22. FProperties: TObjectList;
  23. FCreated: Boolean;
  24. function GetColumns: TListColumns;
  25. function GetCount: Integer;
  26. function GetOrderStr: string;
  27. procedure CheckBounds(Index: Integer);
  28. procedure SetWidthsStr(Value: string; PixelsPerInch: Integer);
  29. function GetWidthsStr: string;
  30. procedure SetOrderStr(Value: string);
  31. protected
  32. FListView: TCustomListView;
  33. FListViewManaged: Boolean;
  34. FConstraintsInitialized: Boolean;
  35. function GetAlignments(Index: Integer): TAlignment;
  36. function GetParamsStr: string; virtual;
  37. function GetVisible(Index: Integer): Boolean;
  38. function GetWidths(Index: Integer): Integer;
  39. procedure SetAlignments(Index: Integer; Value: TAlignment);
  40. procedure SetVisible(Index: Integer; Value: Boolean);
  41. procedure SetWidths(Index: Integer; Value: Integer);
  42. function GetCaptions(Index: Integer): string;
  43. procedure Changed; virtual;
  44. procedure SetCaptions(Index: Integer; Value: string); virtual;
  45. procedure SetParamsStr(Value: string); virtual;
  46. procedure UpdateListView;
  47. procedure UpdateFromListView;
  48. procedure UpdateOrderFromListView;
  49. procedure UpdateListViewOrder;
  50. procedure UpdateListViewMaxMinWidth;
  51. function GetProperties(Index: Integer): TCustomListViewColProperty;
  52. function GetIndexByOrder(Order: Integer): Integer;
  53. function ColumnsExists: Boolean;
  54. procedure SetRuntimeVisible(Index: Integer; Value: Boolean; SaveWidth: Boolean);
  55. function GetColumn(Index: Integer): TListColumn;
  56. procedure CreateProperties(ACount: Integer);
  57. property Columns: TListColumns read GetColumns stored False;
  58. public
  59. constructor Create(ListView: TCustomListView; ColCount: Integer);
  60. destructor Destroy; override;
  61. procedure EndUpdate;
  62. procedure BeginUpdate;
  63. procedure ListViewWndCreated;
  64. procedure ListViewWndDestroying;
  65. procedure ListViewWndDestroyed;
  66. property Count: Integer read GetCount stored False;
  67. property Alignments[Index: Integer]: TAlignment read GetAlignments write SetAlignments;
  68. property Captions[Index: Integer]: string read GetCaptions write SetCaptions;
  69. property Widths[Index: Integer]: Integer read GetWidths write SetWidths;
  70. property Visible[Index: Integer]: Boolean read GetVisible write SetVisible;
  71. procedure RecreateColumns;
  72. property OnChange: TNotifyEvent read FOnChange write FOnChange;
  73. property ParamsStr: string read GetParamsStr write SetParamsStr stored False;
  74. end; { TCustomListViewColProperties }
  75. type
  76. TListViewColProperties = class(TCustomListViewColProperties)
  77. published
  78. end; { TListViewColProperties }
  79. implementation
  80. uses
  81. SysUtils, CommCtrl, Windows, PasTools, Controls, Forms;
  82. const
  83. DefaultListViewMaxWidth = 1000;
  84. DefaultListViewMinWidth = 20;
  85. { TODO : V ListView zamezit zmenu velikosti neviditelnych sloupecku }
  86. constructor TCustomListViewColProperty.Create(AOrder: Integer);
  87. begin
  88. Alignment := taLeftJustify;
  89. Caption := '';
  90. Width := 50;
  91. Visible := True;
  92. Order := AOrder;
  93. end;
  94. { TCustomListViewColProperties }
  95. constructor TCustomListViewColProperties.Create(
  96. ListView: TCustomListView; ColCount: Integer);
  97. var
  98. ACount: Integer;
  99. begin
  100. // This contructor (and constructors of descendants)
  101. // is only even called from implementations of
  102. // TCustomNortonLikeListView.NewColProperties
  103. inherited Create;
  104. FConstraintsInitialized := False;
  105. FCreated := False;
  106. FUpdating := 0;
  107. FChanged := False;
  108. // ColCount is not 0 for file panels (TDirView and TCustomUnixDirView).
  109. // It is 0 otherwise.
  110. FListViewManaged := (ColCount = 0);
  111. FListView := ListView;
  112. FProperties := TObjectList.Create;
  113. if FListViewManaged then ACount := GetColumns.Count
  114. else ACount := ColCount;
  115. CreateProperties(ACount);
  116. if not Assigned(FListView) then
  117. raise Exception.Create('NIL ListView pointer.');
  118. end;
  119. destructor TCustomListViewColProperties.Destroy;
  120. begin
  121. inherited;
  122. FProperties.Free;
  123. end;
  124. procedure TCustomListViewColProperties.SetWidthsStr(Value: string; PixelsPerInch: Integer);
  125. var
  126. ColStr: string;
  127. Index: Integer;
  128. begin
  129. Index := 0;
  130. BeginUpdate;
  131. try
  132. while (Value <> '') and (Index < Count) do
  133. begin
  134. ColStr := CutToChar(Value, ';', True);
  135. Widths[Index] := LoadDimension(StrToInt(CutToChar(ColStr, ',', True)), PixelsPerInch, FListView);
  136. Visible[Index] := Boolean(StrToInt(CutToChar(ColStr, ',', True)));
  137. Inc(Index);
  138. end;
  139. finally
  140. EndUpdate;
  141. end;
  142. end;
  143. function TCustomListViewColProperties.GetWidthsStr: string;
  144. var
  145. Index: Integer;
  146. begin
  147. Result := '';
  148. for Index := 0 to Count-1 do
  149. Result := Format('%s;%d,%d', [Result, SaveDimension(Widths[Index]), Integer(Visible[Index])]);
  150. Delete(Result, 1, 1);
  151. end;
  152. procedure TCustomListViewColProperties.BeginUpdate;
  153. begin
  154. Columns.BeginUpdate;
  155. Inc(FUpdating);
  156. end;
  157. procedure TCustomListViewColProperties.EndUpdate;
  158. begin
  159. Columns.EndUpdate;
  160. Dec(FUpdating);
  161. if FUpdating = 0 then
  162. begin
  163. // call Changed() even when FChange is false
  164. Changed;
  165. FChanged := False;
  166. end;
  167. end;
  168. procedure TCustomListViewColProperties.Changed;
  169. begin
  170. if FUpdating > 0 then FChanged := True
  171. else
  172. if Assigned(FOnChange) then FOnChange(Self);
  173. end;
  174. procedure TCustomListViewColProperties.CheckBounds(Index: Integer);
  175. begin
  176. if (Index < 0) or (Index >= Count) then
  177. raise Exception.Create('Index out of bounds.');
  178. end;
  179. function TCustomListViewColProperties.GetProperties(Index: Integer): TCustomListViewColProperty;
  180. begin
  181. Result := TCustomListViewColProperty(FProperties.Items[Index]);
  182. end;
  183. function TCustomListViewColProperties.GetIndexByOrder(Order: Integer): Integer;
  184. var
  185. I: Integer;
  186. begin
  187. for I := 0 to Count - 1 do
  188. begin
  189. if GetProperties(I).Order = Order then
  190. begin
  191. Result := I;
  192. Exit;
  193. end;
  194. end;
  195. raise Exception.Create('Column order out of bounds');
  196. end;
  197. function TCustomListViewColProperties.ColumnsExists: Boolean;
  198. begin
  199. Result := FListView.HandleAllocated;
  200. if Result and (not FCreated) and (not FListViewManaged) then
  201. UpdateListView;
  202. end;
  203. procedure TCustomListViewColProperties.SetAlignments(Index: Integer; Value: TAlignment);
  204. begin
  205. CheckBounds(Index);
  206. if Alignments[Index] <> Value then
  207. begin
  208. GetProperties(Index).Alignment := Value;
  209. if ColumnsExists then GetColumn(Index).Alignment := Value;
  210. Changed;
  211. end;
  212. end;
  213. procedure TCustomListViewColProperties.SetCaptions(Index: Integer; Value: string);
  214. begin
  215. CheckBounds(Index);
  216. if Captions[Index] <> Value then
  217. begin
  218. if ColumnsExists then GetColumn(Index).Caption := Value
  219. else GetProperties(Index).Caption := Value;
  220. Changed;
  221. end;
  222. end;
  223. function TCustomListViewColProperties.GetAlignments(Index: Integer): TAlignment;
  224. begin
  225. CheckBounds(Index);
  226. if ColumnsExists then Result := GetColumn(Index).Alignment
  227. else Result := GetProperties(Index).Alignment;
  228. end;
  229. function TCustomListViewColProperties.GetCaptions(Index: Integer): string;
  230. begin
  231. CheckBounds(Index);
  232. if ColumnsExists then Result := GetColumn(Index).Caption
  233. else Result := GetProperties(Index).Caption;
  234. end;
  235. procedure TCustomListViewColProperties.SetOrderStr(Value: string);
  236. var
  237. Order, Index: Integer;
  238. Properties: TCustomListViewColProperty;
  239. STemp: string;
  240. Phase: Boolean;
  241. begin
  242. BeginUpdate;
  243. try
  244. for Index := 0 to Count - 1 do
  245. GetProperties(Index).Order := -1;
  246. // First order invisible columns (not True), then visible (not not True)
  247. Phase := True;
  248. Order := 0;
  249. repeat
  250. Phase := not Phase;
  251. STemp := Value;
  252. while (STemp <> '') and (Order < Count) do
  253. begin
  254. Index := StrToInt(CutToChar(STemp, ';', True));
  255. Properties := GetProperties(Index);
  256. if (Properties.Visible = Phase) and
  257. (Properties.Order < 0) { robustness } then
  258. begin
  259. Properties.Order := Order;
  260. Inc(Order);
  261. end;
  262. end;
  263. // add missing columns from the same visibility class
  264. for Index := 0 to Count - 1 do
  265. begin
  266. Properties := GetProperties(Index);
  267. if (Properties.Visible = Phase) and
  268. (Properties.Order < 0) then
  269. begin
  270. Properties.Order := Order;
  271. Inc(Order);
  272. end;
  273. end;
  274. until Phase;
  275. if ColumnsExists then
  276. UpdateListViewOrder;
  277. finally
  278. EndUpdate;
  279. end;
  280. end;
  281. procedure TCustomListViewColProperties.SetParamsStr(Value: string);
  282. var
  283. S: string;
  284. WidthsStr: string;
  285. OrderStr: string;
  286. PixelsPerInch: Integer;
  287. begin
  288. S := CutToChar(Value, '|', True);
  289. WidthsStr := CutToChar(S, '@', True);
  290. PixelsPerInch := LoadPixelsPerInch(S, FListView);
  291. SetWidthsStr(WidthsStr, PixelsPerInch);
  292. // Have to set order after visibility, otherwise we lost ordering of columns that are invisible by default,
  293. // but visible by configuration (as they would get ordered to the front)
  294. OrderStr := CutToChar(Value, '|', True);
  295. SetOrderStr(OrderStr);
  296. end;
  297. procedure TCustomListViewColProperties.SetVisible(Index: Integer; Value: Boolean);
  298. var
  299. I: Integer;
  300. Properties: TCustomListViewColProperty;
  301. begin
  302. CheckBounds(Index);
  303. if Visible[Index] <> Value then
  304. begin
  305. Properties := GetProperties(Index);
  306. if ColumnsExists then
  307. UpdateOrderFromListView;
  308. if Value then
  309. begin
  310. // shown column is moved to the back
  311. for I := 0 to Count - 1 do
  312. begin
  313. if GetProperties(I).Order > Properties.Order then
  314. Dec(GetProperties(I).Order);
  315. end;
  316. Properties.Order := Count - 1;
  317. if ColumnsExists then
  318. UpdateListViewOrder;
  319. // show only after reordering column
  320. Properties.Visible := True;
  321. if ColumnsExists then
  322. SetRuntimeVisible(Index, True, True);
  323. end
  324. else
  325. begin
  326. // hide before reordering column
  327. Properties.Visible := False;
  328. if ColumnsExists then
  329. SetRuntimeVisible(Index, False, True);
  330. // hidden column is moved to the front,
  331. // unless column to the left is not hidden already
  332. // (or unless it is first already, in which case the
  333. // condition in the loop is never satisfied)
  334. if (Properties.Order > 0) and
  335. GetProperties(GetIndexByOrder(Properties.Order - 1)).Visible then
  336. begin
  337. for I := 0 to Count - 1 do
  338. begin
  339. if GetProperties(I).Order < Properties.Order then
  340. Inc(GetProperties(I).Order);
  341. end;
  342. Properties.Order := 0;
  343. end;
  344. if ColumnsExists then
  345. UpdateListViewOrder;
  346. end;
  347. Changed;
  348. // It does not refresh itself at last one on Win7 when DoubleBuffered
  349. if FListView.HandleAllocated then
  350. FListView.Invalidate;
  351. end;
  352. end;
  353. procedure TCustomListViewColProperties.SetRuntimeVisible(
  354. Index: Integer; Value: Boolean; SaveWidth: Boolean);
  355. var
  356. Properties: TCustomListViewColProperty;
  357. begin
  358. // This is probably only ever called from file panels (DirViews)
  359. // as other uses ("sychronization checklist" and "file find")
  360. // have FListViewManaged = False and never change Visible property
  361. // (though user can hide some columns manually in configuration storage)
  362. with GetColumn(Index) do
  363. begin
  364. Properties := GetProperties(Index);
  365. if Value then
  366. begin
  367. MaxWidth := Properties.MaxWidth;
  368. MinWidth := Properties.MinWidth;
  369. Width := Properties.Width;
  370. end
  371. else
  372. begin
  373. if SaveWidth then
  374. Properties.Width := Width;
  375. MaxWidth := 1;
  376. MinWidth := 0;
  377. Width := 0
  378. end;
  379. end;
  380. end;
  381. procedure TCustomListViewColProperties.SetWidths(Index: Integer; Value: Integer);
  382. var
  383. Properties: TCustomListViewColProperty;
  384. begin
  385. CheckBounds(Index);
  386. Properties := GetProperties(Index);
  387. if (Properties.MinWidth > 0) and (Value < Properties.MinWidth) then
  388. begin
  389. Value := Properties.MinWidth;
  390. end
  391. else
  392. if (Properties.MaxWidth > 0) and (Value > Properties.MaxWidth) then
  393. begin
  394. Value := Properties.MaxWidth;
  395. end;
  396. if Widths[Index] <> Value then
  397. begin
  398. Properties.Width := Value;
  399. if ColumnsExists and Visible[Index] then GetColumn(Index).Width := Value;
  400. Changed;
  401. end;
  402. end;
  403. function TCustomListViewColProperties.GetColumns: TListColumns;
  404. begin
  405. Result := TListView(FListView).Columns;
  406. end;
  407. function TCustomListViewColProperties.GetColumn(Index: Integer): TListColumn;
  408. begin
  409. Result := Columns[Index];
  410. end;
  411. function TCustomListViewColProperties.GetCount: Integer;
  412. begin
  413. Result := FProperties.Count;
  414. end;
  415. function TCustomListViewColProperties.GetOrderStr: string;
  416. var
  417. Index: Integer;
  418. begin
  419. Result := '';
  420. if ColumnsExists then
  421. UpdateOrderFromListView;
  422. for Index := 0 to Count - 1 do
  423. Result := Format('%s;%d', [Result, GetIndexByOrder(Index)]);
  424. Delete(Result, 1, 1);
  425. end;
  426. function TCustomListViewColProperties.GetParamsStr: string;
  427. begin
  428. // WORKAROUND
  429. // Adding an additional semicolon after the list,
  430. // to ensure that old versions that did not expect the pixels-per-inch part,
  431. // stop at the semicolon, otherwise they try to parse the
  432. // "last-column-width|pixels-per-inch" as integer and throw.
  433. // For the other instance of this hack, see GetListViewStr.
  434. // The new pixels-per-inch part is inserted after the widths part
  435. // as parsing of this was always robust to stop at "count" elements,
  436. // what order part was not (due to its logic of skipping hidden columns)
  437. Result := Format('%s;@%s|%s', [GetWidthsStr, SavePixelsPerInch(FListView), GetOrderStr]);
  438. end;
  439. function TCustomListViewColProperties.GetVisible(Index: Integer): Boolean;
  440. begin
  441. CheckBounds(Index);
  442. Result := GetProperties(Index).Visible;
  443. end;
  444. function TCustomListViewColProperties.GetWidths(Index: Integer): Integer;
  445. begin
  446. CheckBounds(Index);
  447. if ColumnsExists and Visible[Index] then Result := GetColumn(Index).Width
  448. else Result := GetProperties(Index).Width;
  449. end;
  450. procedure TCustomListViewColProperties.RecreateColumns;
  451. var
  452. Copy: TListColumns;
  453. begin
  454. Copy := TListColumns.Create(nil);
  455. try
  456. Copy.Assign(Columns);
  457. Columns.Assign(Copy);
  458. finally
  459. Copy.Free;
  460. end;
  461. end;
  462. procedure TCustomListViewColProperties.CreateProperties(ACount: Integer);
  463. var
  464. Index: Integer;
  465. Properties: TCustomListViewColProperty;
  466. begin
  467. for Index := 0 to ACount - 1 do
  468. begin
  469. Properties := TCustomListViewColProperty.Create(Index);
  470. FProperties.Add(Properties);
  471. end;
  472. end;
  473. procedure TCustomListViewColProperties.ListViewWndCreated;
  474. var
  475. Index: Integer;
  476. Properties: TCustomListViewColProperty;
  477. Column: TListColumn;
  478. W: Integer;
  479. begin
  480. if FListViewManaged then
  481. begin
  482. if (FProperties.Count = 0) and (Columns.Count > 0) then
  483. CreateProperties(Columns.Count);
  484. UpdateFromListView;
  485. end
  486. else
  487. begin
  488. UpdateListView;
  489. end;
  490. if not FConstraintsInitialized then
  491. begin
  492. FConstraintsInitialized := True;
  493. for Index := 0 to Count - 1 do
  494. begin
  495. Column := GetColumn(Index);
  496. Properties := GetProperties(Index);
  497. // Is this branching needed?
  498. if Properties.Visible then
  499. begin
  500. W := Column.MaxWidth;
  501. if W = 0 then W := DefaultListViewMaxWidth;
  502. Properties.MaxWidth := ScaleByTextHeight(FListView, W);
  503. W := Column.MinWidth;
  504. if W = 0 then W := DefaultListViewMinWidth;
  505. Properties.MinWidth := ScaleByTextHeight(FListView, W);
  506. end
  507. else
  508. begin
  509. Column.MaxWidth := ScaleByTextHeight(FListView, Column.MaxWidth);
  510. Column.MinWidth := ScaleByTextHeight(FListView, Column.MinWidth);
  511. end;
  512. end;
  513. end;
  514. // To apply the default constraints to columns that do not have their own
  515. UpdateListViewMaxMinWidth;
  516. end;
  517. procedure TCustomListViewColProperties.ListViewWndDestroying;
  518. begin
  519. UpdateFromListView;
  520. end;
  521. procedure TCustomListViewColProperties.ListViewWndDestroyed;
  522. begin
  523. if not FListViewManaged then
  524. FCreated := False;
  525. end;
  526. procedure TCustomListViewColProperties.UpdateListViewOrder;
  527. var
  528. Index: Integer;
  529. Properties: TCustomListViewColProperty;
  530. Temp: array of Integer;
  531. begin
  532. SetLength(Temp, Count);
  533. // Seemingly useless,
  534. // but probably only because we swallow HDN_ENDDRAG in TCustomIEListView.WMNotify,
  535. // what prevents VLC from actually reordering columns collection
  536. ListView_GetColumnOrderArray(FListView.Handle, Count, PInteger(Temp));
  537. for Index := 0 to Count - 1 do
  538. begin
  539. Properties := GetProperties(Index);
  540. Temp[Properties.Order] := Index;
  541. end;
  542. ListView_SetColumnOrderArray(FListView.Handle, Count, PInteger(Temp));
  543. end;
  544. procedure TCustomListViewColProperties.UpdateListViewMaxMinWidth;
  545. var
  546. Index: Integer;
  547. Column: TListColumn;
  548. Properties: TCustomListViewColProperty;
  549. begin
  550. Assert(ColumnsExists);
  551. for Index := 0 to Count-1 do
  552. begin
  553. Column := GetColumn(Index);
  554. Properties := GetProperties(Index);
  555. if Properties.Visible then
  556. begin
  557. Column.MaxWidth := Properties.MaxWidth;
  558. if Column.Width > Column.MaxWidth then Column.Width := Column.MaxWidth;
  559. Column.MinWidth := Properties.MinWidth;
  560. if Column.Width < Column.MinWidth then Column.Width := Column.MinWidth;
  561. end;
  562. end;
  563. end;
  564. procedure TCustomListViewColProperties.UpdateListView;
  565. var
  566. Index: Integer;
  567. Column: TListColumn;
  568. Properties: TCustomListViewColProperty;
  569. begin
  570. // Only called when FListViewManaged = False
  571. BeginUpdate;
  572. try
  573. for Index := 0 to Count-1 do
  574. begin
  575. if Index < Columns.Count then
  576. Column := GetColumn(Index)
  577. else
  578. Column := Columns.Add;
  579. Properties := GetProperties(Index);
  580. Column.Alignment := Properties.Alignment;
  581. Column.Caption := Properties.Caption;
  582. SetRuntimeVisible(Index, Properties.Visible, False);
  583. end;
  584. UpdateListViewOrder;
  585. finally
  586. FCreated := True;
  587. EndUpdate;
  588. end;
  589. end;
  590. procedure TCustomListViewColProperties.UpdateOrderFromListView;
  591. var
  592. Index: Integer;
  593. Temp: array of Integer;
  594. begin
  595. SetLength(Temp, Count);
  596. ListView_GetColumnOrderArray(FListView.Handle, Count, PInteger(Temp));
  597. for Index := 0 to Count - 1 do
  598. begin
  599. GetProperties(Temp[Index]).Order := Index;
  600. end;
  601. end;
  602. procedure TCustomListViewColProperties.UpdateFromListView;
  603. var
  604. Index: Integer;
  605. Column: TListColumn;
  606. Properties: TCustomListViewColProperty;
  607. begin
  608. Assert(FProperties.Count = Columns.Count);
  609. for Index := 0 to Count-1 do
  610. begin
  611. Column := GetColumn(Index);
  612. Properties := GetProperties(Index);
  613. Properties.Alignment := Column.Alignment;
  614. Properties.Caption := Column.Caption;
  615. if Properties.Visible then
  616. begin
  617. Properties.Width := Column.Width;
  618. if Column.MaxWidth > 0 then
  619. Properties.MaxWidth := Column.MaxWidth;
  620. if Column.MinWidth > 0 then
  621. Properties.MinWidth := Column.MinWidth;
  622. end;
  623. end;
  624. UpdateOrderFromListView;
  625. end;
  626. end.