If the first column with the number of the column has too less width, sometimes it's not clear that the user can resize it to show its whole text. This change adds an auto-resize mechanism, which is fired after any node structure was changed. Fixes issue #1609.

This commit is contained in:
Ansgar Becker
2010-01-18 08:22:18 +00:00
parent a9e1f12096
commit a0a1ed24c2
2 changed files with 11 additions and 0 deletions

View File

@ -174,6 +174,8 @@ type
procedure listColumnsKeyPress(Sender: TObject; var Key: Char);
procedure vtHandleClickOrKeyPress(Sender: TVirtualStringTree;
Node: PVirtualNode; Column: TColumnIndex; HitPositions: THitPositions);
procedure listColumnsStructureChange(Sender: TBaseVirtualTree;
Node: PVirtualNode; Reason: TChangeReason);
private
{ Private declarations }
FLoaded: Boolean;
@ -1087,6 +1089,14 @@ begin
end;
procedure TfrmTableEditor.listColumnsStructureChange(Sender: TBaseVirtualTree;
Node: PVirtualNode; Reason: TChangeReason);
begin
// Auto resize first column to optimal width
listColumns.Header.AutoFitColumns(False, smaUseColumnOption, 0, 0);
end;
procedure TfrmTableEditor.listColumnsNewText(Sender: TBaseVirtualTree;
Node: PVirtualNode; Column: TColumnIndex; NewText: String);
var