Data type selector: Do not set tree width to the parent column's width, which is mostly too small. Rather do an autofit on the first column so it's as wide as the text needs space.

This commit is contained in:
Ansgar Becker
2009-07-08 20:11:01 +00:00
parent c2221ae50f
commit a1ab1d8a9a

View File

@ -1472,8 +1472,6 @@ begin
FTreeSelect.TreeOptions.SelectionOptions := FTreeSelect.TreeOptions.SelectionOptions FTreeSelect.TreeOptions.SelectionOptions := FTreeSelect.TreeOptions.SelectionOptions
+ [toFullRowSelect]; + [toFullRowSelect];
FTreeSelect.Header.Columns.Add; FTreeSelect.Header.Columns.Add;
FTreeSelect.Header.AutoSizeIndex := 0;
FTreeSelect.Header.Options := FTreeSelect.Header.Options + [hoAutoResize];
FTreeSelect.Parent := ParentControl; FTreeSelect.Parent := ParentControl;
FTreeSelect.TextMargin := 0; FTreeSelect.TextMargin := 0;
FTreeSelect.RootNodeCount := Length(DatatypeCategories); FTreeSelect.RootNodeCount := Length(DatatypeCategories);
@ -1542,6 +1540,7 @@ begin
end; end;
CatNode := FTreeSelect.GetNextSibling(CatNode); CatNode := FTreeSelect.GetNextSibling(CatNode);
end; end;
FTreeSelect.Header.AutoFitColumns(False, smaUseColumnOption, 0, 0);
if Assigned(FTreeSelect.FocusedNode) then if Assigned(FTreeSelect.FocusedNode) then
FTreeSelect.ScrollIntoView(FTreeSelect.FocusedNode, True); FTreeSelect.ScrollIntoView(FTreeSelect.FocusedNode, True);
FTreeSelect.OnFocusChanging := DoTreeSelectFocusChanging; FTreeSelect.OnFocusChanging := DoTreeSelectFocusChanging;
@ -1598,7 +1597,7 @@ begin
// Set position of tree. As the tree's parent is mainform, not listcolumns, add listcolumn's x + y positions // Set position of tree. As the tree's parent is mainform, not listcolumns, add listcolumn's x + y positions
FTreeSelect.SetBounds(R.Left + FTree.ClientOrigin.X, FTreeSelect.SetBounds(R.Left + FTree.ClientOrigin.X,
R.Top + FTree.ClientOrigin.Y - FTreeSelect.Header.Height - GetSystemMetrics(SM_CYMENU), R.Top + FTree.ClientOrigin.Y - FTreeSelect.Header.Height - GetSystemMetrics(SM_CYMENU),
R.Right-R.Left, FTreeSelect.Header.Columns[0].Width + GetSystemMetrics(SM_CXVSCROLL) + 5,
250); 250);
end; end;