ListViewColProperties.pas 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722
  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. begin
  150. Result := Format('%s;%d,%d', [Result, SaveDimension(Widths[Index]), Integer(Visible[Index])]);
  151. end;
  152. Delete(Result, 1, 1);
  153. end;
  154. procedure TCustomListViewColProperties.BeginUpdate;
  155. begin
  156. Columns.BeginUpdate;
  157. Inc(FUpdating);
  158. end;
  159. procedure TCustomListViewColProperties.EndUpdate;
  160. begin
  161. Columns.EndUpdate;
  162. Dec(FUpdating);
  163. if FUpdating = 0 then
  164. begin
  165. // call Changed() even when FChange is false
  166. Changed;
  167. FChanged := False;
  168. end;
  169. end;
  170. procedure TCustomListViewColProperties.Changed;
  171. begin
  172. if FUpdating > 0 then FChanged := True
  173. else
  174. if Assigned(FOnChange) then FOnChange(Self);
  175. end;
  176. procedure TCustomListViewColProperties.CheckBounds(Index: Integer);
  177. begin
  178. if (Index < 0) or (Index >= Count) then
  179. raise Exception.Create('Index out of bounds.');
  180. end;
  181. function TCustomListViewColProperties.GetProperties(Index: Integer): TCustomListViewColProperty;
  182. begin
  183. Result := TCustomListViewColProperty(FProperties.Items[Index]);
  184. end;
  185. function TCustomListViewColProperties.GetIndexByOrder(Order: Integer): Integer;
  186. var
  187. I: Integer;
  188. begin
  189. for I := 0 to Count - 1 do
  190. begin
  191. if GetProperties(I).Order = Order then
  192. begin
  193. Result := I;
  194. Exit;
  195. end;
  196. end;
  197. raise Exception.Create('Column order out of bounds');
  198. end;
  199. function TCustomListViewColProperties.ColumnsExists: Boolean;
  200. begin
  201. Result := FListView.HandleAllocated;
  202. if Result and (not FCreated) and (not FListViewManaged) then
  203. UpdateListView;
  204. end;
  205. procedure TCustomListViewColProperties.SetAlignments(Index: Integer; Value: TAlignment);
  206. begin
  207. CheckBounds(Index);
  208. if Alignments[Index] <> Value then
  209. begin
  210. GetProperties(Index).Alignment := Value;
  211. if ColumnsExists then GetColumn(Index).Alignment := Value;
  212. Changed;
  213. end;
  214. end;
  215. procedure TCustomListViewColProperties.SetCaptions(Index: Integer; Value: string);
  216. begin
  217. CheckBounds(Index);
  218. if Captions[Index] <> Value then
  219. begin
  220. if ColumnsExists then GetColumn(Index).Caption := Value
  221. else GetProperties(Index).Caption := Value;
  222. Changed;
  223. end;
  224. end;
  225. function TCustomListViewColProperties.GetAlignments(Index: Integer): TAlignment;
  226. begin
  227. CheckBounds(Index);
  228. if ColumnsExists then Result := GetColumn(Index).Alignment
  229. else Result := GetProperties(Index).Alignment;
  230. end;
  231. function TCustomListViewColProperties.GetCaptions(Index: Integer): string;
  232. begin
  233. CheckBounds(Index);
  234. if ColumnsExists then Result := GetColumn(Index).Caption
  235. else Result := GetProperties(Index).Caption;
  236. end;
  237. procedure TCustomListViewColProperties.SetOrderStr(Value: string);
  238. var
  239. Order, Index: Integer;
  240. Properties: TCustomListViewColProperty;
  241. STemp: string;
  242. Phase: Boolean;
  243. begin
  244. BeginUpdate;
  245. try
  246. for Index := 0 to Count - 1 do
  247. GetProperties(Index).Order := -1;
  248. // First order invisible columns (not True), then visible (not not True)
  249. Phase := True;
  250. Order := 0;
  251. repeat
  252. Phase := not Phase;
  253. STemp := Value;
  254. while (STemp <> '') and (Order < Count) do
  255. begin
  256. Index := StrToInt(CutToChar(STemp, ';', True));
  257. Properties := GetProperties(Index);
  258. if (Properties.Visible = Phase) and
  259. (Properties.Order < 0) { robustness } then
  260. begin
  261. Properties.Order := Order;
  262. Inc(Order);
  263. end;
  264. end;
  265. // add missing columns from the same visibility class
  266. for Index := 0 to Count - 1 do
  267. begin
  268. Properties := GetProperties(Index);
  269. if (Properties.Visible = Phase) and
  270. (Properties.Order < 0) then
  271. begin
  272. Properties.Order := Order;
  273. Inc(Order);
  274. end;
  275. end;
  276. until Phase;
  277. if ColumnsExists then
  278. UpdateListViewOrder;
  279. finally
  280. EndUpdate;
  281. end;
  282. end;
  283. procedure TCustomListViewColProperties.SetParamsStr(Value: string);
  284. var
  285. S: string;
  286. WidthsStr: string;
  287. OrderStr: string;
  288. PixelsPerInch: Integer;
  289. begin
  290. S := CutToChar(Value, '|', True);
  291. WidthsStr := CutToChar(S, '@', True);
  292. PixelsPerInch := LoadPixelsPerInch(S, FListView);
  293. SetWidthsStr(WidthsStr, PixelsPerInch);
  294. // Have to set order after visibility, otherwise we lost ordering of columns that are invisible by default,
  295. // but visible by configuration (as they would get ordered to the front)
  296. OrderStr := CutToChar(Value, '|', True);
  297. SetOrderStr(OrderStr);
  298. end;
  299. procedure TCustomListViewColProperties.SetVisible(Index: Integer; Value: Boolean);
  300. var
  301. I: Integer;
  302. Properties: TCustomListViewColProperty;
  303. begin
  304. CheckBounds(Index);
  305. if Visible[Index] <> Value then
  306. begin
  307. Properties := GetProperties(Index);
  308. if ColumnsExists then
  309. UpdateOrderFromListView;
  310. if Value then
  311. begin
  312. // shown column is moved to the back
  313. for I := 0 to Count - 1 do
  314. begin
  315. if GetProperties(I).Order > Properties.Order then
  316. Dec(GetProperties(I).Order);
  317. end;
  318. Properties.Order := Count - 1;
  319. if ColumnsExists then
  320. UpdateListViewOrder;
  321. // show only after reordering column
  322. Properties.Visible := True;
  323. if ColumnsExists then
  324. SetRuntimeVisible(Index, True, True);
  325. end
  326. else
  327. begin
  328. // hide before reordering column
  329. Properties.Visible := False;
  330. if ColumnsExists then
  331. SetRuntimeVisible(Index, False, True);
  332. // hidden column is moved to the front,
  333. // unless column to the left is not hidden already
  334. // (or unless it is first already, in which case the
  335. // condition in the loop is never satisfied)
  336. if (Properties.Order > 0) and
  337. GetProperties(GetIndexByOrder(Properties.Order - 1)).Visible then
  338. begin
  339. for I := 0 to Count - 1 do
  340. begin
  341. if GetProperties(I).Order < Properties.Order then
  342. Inc(GetProperties(I).Order);
  343. end;
  344. Properties.Order := 0;
  345. end;
  346. if ColumnsExists then
  347. UpdateListViewOrder;
  348. end;
  349. Changed;
  350. // It does not refresh itself at last one on Win7 when DoubleBuffered
  351. if FListView.HandleAllocated then
  352. FListView.Invalidate;
  353. end;
  354. end;
  355. procedure TCustomListViewColProperties.SetRuntimeVisible(
  356. Index: Integer; Value: Boolean; SaveWidth: Boolean);
  357. var
  358. Properties: TCustomListViewColProperty;
  359. begin
  360. // This is probably only ever called from file panels (DirViews)
  361. // as other uses ("sychronization checklist" and "file find")
  362. // have FListViewManaged = False and never change Visible property
  363. // (though user can hide some columns manually in configuration storage)
  364. with GetColumn(Index) do
  365. begin
  366. Properties := GetProperties(Index);
  367. if Value then
  368. begin
  369. MaxWidth := Properties.MaxWidth;
  370. MinWidth := Properties.MinWidth;
  371. Width := Properties.Width;
  372. end
  373. else
  374. begin
  375. if SaveWidth then
  376. Properties.Width := Width;
  377. MaxWidth := 1;
  378. MinWidth := 0;
  379. Width := 0
  380. end;
  381. end;
  382. end;
  383. procedure TCustomListViewColProperties.SetWidths(Index: Integer; Value: Integer);
  384. var
  385. Properties: TCustomListViewColProperty;
  386. begin
  387. CheckBounds(Index);
  388. Properties := GetProperties(Index);
  389. if (Properties.MinWidth > 0) and (Value < Properties.MinWidth) then
  390. begin
  391. Value := Properties.MinWidth;
  392. end
  393. else
  394. if (Properties.MaxWidth > 0) and (Value > Properties.MaxWidth) then
  395. begin
  396. Value := Properties.MaxWidth;
  397. end;
  398. if Widths[Index] <> Value then
  399. begin
  400. Properties.Width := Value;
  401. if ColumnsExists and Visible[Index] then GetColumn(Index).Width := Value;
  402. Changed;
  403. end;
  404. end;
  405. function TCustomListViewColProperties.GetColumns: TListColumns;
  406. begin
  407. Result := TListView(FListView).Columns;
  408. end;
  409. function TCustomListViewColProperties.GetColumn(Index: Integer): TListColumn;
  410. begin
  411. Result := Columns[Index];
  412. end;
  413. function TCustomListViewColProperties.GetCount: Integer;
  414. begin
  415. Result := FProperties.Count;
  416. end;
  417. function TCustomListViewColProperties.GetOrderStr: string;
  418. var
  419. Index: Integer;
  420. begin
  421. Result := '';
  422. if ColumnsExists then
  423. UpdateOrderFromListView;
  424. for Index := 0 to Count - 1 do
  425. Result := Format('%s;%d', [Result, GetIndexByOrder(Index)]);
  426. Delete(Result, 1, 1);
  427. end;
  428. function TCustomListViewColProperties.GetParamsStr: string;
  429. begin
  430. // WORKAROUND
  431. // Adding an additional semicolon after the list,
  432. // to ensure that old versions that did not expect the pixels-per-inch part,
  433. // stop at the semicolon, otherwise they try to parse the
  434. // "last-column-width|pixels-per-inch" as integer and throw.
  435. // For the other instance of this hack, see GetListViewStr.
  436. // The new pixels-per-inch part is inserted after the widths part
  437. // as parsing of this was always robust to stop at "count" elements,
  438. // what order part was not (due to its logic of skipping hidden columns)
  439. Result := Format('%s;@%s|%s', [GetWidthsStr, SavePixelsPerInch(FListView), GetOrderStr]);
  440. end;
  441. function TCustomListViewColProperties.GetVisible(Index: Integer): Boolean;
  442. begin
  443. CheckBounds(Index);
  444. Result := GetProperties(Index).Visible;
  445. end;
  446. function TCustomListViewColProperties.GetWidths(Index: Integer): Integer;
  447. begin
  448. CheckBounds(Index);
  449. if ColumnsExists and Visible[Index] then
  450. begin
  451. Result := GetColumn(Index).Width;
  452. end
  453. else
  454. begin
  455. Result := GetProperties(Index).Width;
  456. end;
  457. end;
  458. procedure TCustomListViewColProperties.RecreateColumns;
  459. var
  460. Copy: TListColumns;
  461. begin
  462. Copy := TListColumns.Create(nil);
  463. try
  464. Copy.Assign(Columns);
  465. Columns.Assign(Copy);
  466. finally
  467. Copy.Free;
  468. end;
  469. end;
  470. procedure TCustomListViewColProperties.CreateProperties(ACount: Integer);
  471. var
  472. Index: Integer;
  473. Properties: TCustomListViewColProperty;
  474. begin
  475. for Index := 0 to ACount - 1 do
  476. begin
  477. Properties := TCustomListViewColProperty.Create(Index);
  478. FProperties.Add(Properties);
  479. end;
  480. end;
  481. procedure TCustomListViewColProperties.ListViewWndCreated;
  482. var
  483. Index: Integer;
  484. Properties: TCustomListViewColProperty;
  485. Column: TListColumn;
  486. W: Integer;
  487. begin
  488. if FListViewManaged then
  489. begin
  490. if (FProperties.Count = 0) and (Columns.Count > 0) then
  491. CreateProperties(Columns.Count);
  492. UpdateFromListView;
  493. end
  494. else
  495. begin
  496. UpdateListView;
  497. end;
  498. if not FConstraintsInitialized then
  499. begin
  500. FConstraintsInitialized := True;
  501. for Index := 0 to Count - 1 do
  502. begin
  503. Column := GetColumn(Index);
  504. Properties := GetProperties(Index);
  505. // Is this branching needed?
  506. if Properties.Visible then
  507. begin
  508. W := Column.MaxWidth;
  509. if W = 0 then W := DefaultListViewMaxWidth;
  510. Properties.MaxWidth := ScaleByTextHeight(FListView, W);
  511. W := Column.MinWidth;
  512. if W = 0 then W := DefaultListViewMinWidth;
  513. Properties.MinWidth := ScaleByTextHeight(FListView, W);
  514. end
  515. else
  516. begin
  517. Column.MaxWidth := ScaleByTextHeight(FListView, Column.MaxWidth);
  518. Column.MinWidth := ScaleByTextHeight(FListView, Column.MinWidth);
  519. end;
  520. end;
  521. end;
  522. // To apply the default constraints to columns that do not have their own
  523. UpdateListViewMaxMinWidth;
  524. end;
  525. procedure TCustomListViewColProperties.ListViewWndDestroying;
  526. begin
  527. UpdateFromListView;
  528. end;
  529. procedure TCustomListViewColProperties.ListViewWndDestroyed;
  530. begin
  531. if not FListViewManaged then
  532. FCreated := False;
  533. end;
  534. procedure TCustomListViewColProperties.UpdateListViewOrder;
  535. var
  536. Index: Integer;
  537. Properties: TCustomListViewColProperty;
  538. Temp: array of Integer;
  539. begin
  540. SetLength(Temp, Count);
  541. // Seemingly useless,
  542. // but probably only because we swallow HDN_ENDDRAG in TCustomIEListView.WMNotify,
  543. // what prevents VLC from actually reordering columns collection
  544. ListView_GetColumnOrderArray(FListView.Handle, Count, PInteger(Temp));
  545. for Index := 0 to Count - 1 do
  546. begin
  547. Properties := GetProperties(Index);
  548. Temp[Properties.Order] := Index;
  549. end;
  550. ListView_SetColumnOrderArray(FListView.Handle, Count, PInteger(Temp));
  551. end;
  552. procedure TCustomListViewColProperties.UpdateListViewMaxMinWidth;
  553. var
  554. Index: Integer;
  555. Column: TListColumn;
  556. Properties: TCustomListViewColProperty;
  557. begin
  558. Assert(ColumnsExists);
  559. for Index := 0 to Count-1 do
  560. begin
  561. Column := GetColumn(Index);
  562. Properties := GetProperties(Index);
  563. if Properties.Visible then
  564. begin
  565. Column.MaxWidth := Properties.MaxWidth;
  566. if Column.Width > Column.MaxWidth then Column.Width := Column.MaxWidth;
  567. Column.MinWidth := Properties.MinWidth;
  568. if Column.Width < Column.MinWidth then Column.Width := Column.MinWidth;
  569. end;
  570. end;
  571. end;
  572. procedure TCustomListViewColProperties.UpdateListView;
  573. var
  574. Index: Integer;
  575. Column: TListColumn;
  576. Properties: TCustomListViewColProperty;
  577. begin
  578. // Only called when FListViewManaged = False
  579. BeginUpdate;
  580. try
  581. for Index := 0 to Count-1 do
  582. begin
  583. if Index < Columns.Count then
  584. Column := GetColumn(Index)
  585. else
  586. Column := Columns.Add;
  587. Properties := GetProperties(Index);
  588. Column.Alignment := Properties.Alignment;
  589. Column.Caption := Properties.Caption;
  590. SetRuntimeVisible(Index, Properties.Visible, False);
  591. end;
  592. UpdateListViewOrder;
  593. finally
  594. FCreated := True;
  595. EndUpdate;
  596. end;
  597. end;
  598. procedure TCustomListViewColProperties.UpdateOrderFromListView;
  599. var
  600. Index: Integer;
  601. Temp: array of Integer;
  602. begin
  603. SetLength(Temp, Count);
  604. ListView_GetColumnOrderArray(FListView.Handle, Count, PInteger(Temp));
  605. for Index := 0 to Count - 1 do
  606. begin
  607. GetProperties(Temp[Index]).Order := Index;
  608. end;
  609. end;
  610. procedure TCustomListViewColProperties.UpdateFromListView;
  611. var
  612. Index: Integer;
  613. Column: TListColumn;
  614. Properties: TCustomListViewColProperty;
  615. begin
  616. Assert(FProperties.Count = Columns.Count);
  617. for Index := 0 to Count-1 do
  618. begin
  619. Column := GetColumn(Index);
  620. Properties := GetProperties(Index);
  621. Properties.Alignment := Column.Alignment;
  622. Properties.Caption := Column.Caption;
  623. if Properties.Visible then
  624. begin
  625. Properties.Width := Column.Width;
  626. if Column.MaxWidth > 0 then
  627. Properties.MaxWidth := Column.MaxWidth;
  628. if Column.MinWidth > 0 then
  629. Properties.MinWidth := Column.MinWidth;
  630. end;
  631. end;
  632. UpdateOrderFromListView;
  633. end;
  634. end.