1
0
mirror of synced 2024-12-22 17:23:07 +01:00

Added: sorted column color option

This commit is contained in:
Mark van Renswoude 2005-01-25 10:44:32 +00:00
parent 6e63ec4a9c
commit dd3a6eff70

View File

@ -10,24 +10,47 @@ unit X2UtVirtualTree;
interface interface
uses uses
Graphics,
VirtualTrees; VirtualTrees;
//:$ Applies the sort order on the specified column //:$ Applies the sort order on the specified column
//:: When a column is already sorted, the sort order is reversed. //:: When a column is already sorted, the sort order is reversed.
//:: Specify a SortColor to provide the new column with that color
//:: (similar to Explorer in Windows XP). If you choose to use SortColor,
//:: the column's Tag property will be used to restore the color when calling
//:: SortColumn for the second time, so be sure not to rely on that.
procedure SortColumn(const AHeader: TVTHeader; procedure SortColumn(const AHeader: TVTHeader;
const AColumn: TColumnIndex); const AColumn: TColumnIndex;
const ASortColor: TColor = clNone);
implementation implementation
procedure SortColumn; procedure SortColumn;
begin begin
with AHeader do with AHeader do
begin
if (ASortColor <> clNone) and (SortColumn <> -1) then
with Columns[SortColumn] do
if Tag <> 0 then
begin
Color := TColor(Tag);
Tag := 0;
end;
if SortColumn = AColumn then if SortColumn = AColumn then
SortDirection := TSortDirection(1 - Integer(SortDirection)) SortDirection := TSortDirection(1 - Integer(SortDirection))
else begin else begin
SortColumn := AColumn; SortColumn := AColumn;
SortDirection := sdAscending; SortDirection := sdAscending;
end; end;
if ASortColor <> clNone then
with Columns[SortColumn] do
begin
Tag := Color;
Color := ASortColor;
end;
end;
end; end;
end. end.