Paint background of sorted columns light grey. Imitates behaviour of the Windows XP Explorer and adds a clear signal to the user that the list is somehow sorted currently.

This commit is contained in:
Ansgar Becker
2007-08-27 20:58:33 +00:00
parent 5d718e5152
commit c4f7ada3cb
3 changed files with 29 additions and 0 deletions

View File

@@ -132,6 +132,7 @@ object MDIChild: TMDIChild
TreeOptions.MiscOptions = [toToggleOnDblClick]
TreeOptions.PaintOptions = [toShowDropmark, toShowHorzGridLines, toShowVertGridLines, toThemeAware, toUseBlendedImages]
TreeOptions.SelectionOptions = [toFullRowSelect, toRightClickSelect]
OnBeforePaint = vstBeforePaint
OnCompareNodes = vstCompareNodes
OnFreeNode = vstFreeNode
OnGetText = vstGetText
@@ -181,6 +182,7 @@ object MDIChild: TMDIChild
TreeOptions.MiscOptions = [toFullRepaintOnResize, toInitOnSave, toToggleOnDblClick, toWheelPanning]
TreeOptions.PaintOptions = [toShowDropmark, toShowHorzGridLines, toShowVertGridLines, toThemeAware, toUseBlendedImages]
TreeOptions.SelectionOptions = [toFullRowSelect, toRightClickSelect]
OnBeforePaint = vstBeforePaint
OnCompareNodes = vstCompareNodes
OnFreeNode = vstFreeNode
OnGetText = vstGetText
@@ -264,6 +266,7 @@ object MDIChild: TMDIChild
TreeOptions.MiscOptions = [toFullRepaintOnResize, toInitOnSave, toToggleOnDblClick, toWheelPanning]
TreeOptions.PaintOptions = [toShowButtons, toShowDropmark, toShowHorzGridLines, toShowVertGridLines, toThemeAware, toUseBlendedImages]
TreeOptions.SelectionOptions = [toFullRowSelect]
OnBeforePaint = vstBeforePaint
OnCompareNodes = vstCompareNodes
OnFreeNode = vstFreeNode
OnGetText = vstGetText
@@ -376,6 +379,7 @@ object MDIChild: TMDIChild
TreeOptions.MiscOptions = [toEditable, toFullRepaintOnResize, toInitOnSave, toToggleOnDblClick, toWheelPanning]
TreeOptions.PaintOptions = [toShowDropmark, toShowHorzGridLines, toShowVertGridLines, toThemeAware, toUseBlendedImages]
TreeOptions.SelectionOptions = [toFullRowSelect, toMultiSelect, toRightClickSelect]
OnBeforePaint = vstBeforePaint
OnChange = ListTablesChange
OnCompareNodes = vstCompareNodes
OnDblClick = ListTablesDblClick
@@ -665,6 +669,7 @@ object MDIChild: TMDIChild
TreeOptions.MiscOptions = [toAcceptOLEDrop, toEditable, toFullRepaintOnResize, toInitOnSave, toToggleOnDblClick, toWheelPanning]
TreeOptions.PaintOptions = [toShowDropmark, toShowHorzGridLines, toShowVertGridLines, toThemeAware, toUseBlendedImages]
TreeOptions.SelectionOptions = [toFullRowSelect, toMultiSelect, toRightClickSelect]
OnBeforePaint = vstBeforePaint
OnChange = ListColumnsChange
OnCompareNodes = vstCompareNodes
OnDblClick = UpdateField

View File

@@ -502,6 +502,8 @@ type
Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
procedure vstCompareNodes(Sender: TBaseVirtualTree; Node1, Node2:
PVirtualNode; Column: TColumnIndex; var Result: Integer);
procedure vstBeforePaint(Sender: TBaseVirtualTree; TargetCanvas:
TCanvas);
private
strHostRunning : String;
@@ -6076,6 +6078,26 @@ begin
end;
{**
VirtualTree gets painted. Adjust background color of sorted column.
}
procedure TMDIChild.vstBeforePaint(Sender: TBaseVirtualTree;
TargetCanvas: TCanvas);
var
i : Integer;
h : TVTHeader;
begin
h := TVirtualStringTree(Sender).Header;
for i := 0 to h.Columns.Count - 1 do
begin
if h.SortColumn = i then
h.Columns[i].Color := COLOR_SORTCOLUMN
else
h.Columns[i].Color := clWindow;
end;
end;
{**
Return the data array which belongs to a VirtualTree component
}

View File

@@ -23,6 +23,8 @@ const
REGPATH = 'Software\' + APPNAME;
STATUS_MSG_READY = 'Ready.';
STR_NOTSUPPORTED = 'Not supported by this server';
// Used by ListViews
COLOR_SORTCOLUMN = $00F7F7F7;
// Used by maskSQL and fixSQL:
SQL_VERSION_ANSI = -1;