Fix issue #1159: Defaults editor in table editor partly hidden in bottom columns. Moves the defaults editor various calculated pixels to left and top so it fits into the client area.

This commit is contained in:
Ansgar Becker
2009-06-08 19:18:36 +00:00
parent 3bc31db014
commit 6deb924b13

View File

@@ -1045,8 +1045,7 @@ begin
FPanel := TPanel.Create(Tree);
FPanel.Parent := FTree;
FPanel.Left := TextBounds.Left;
FPanel.Top := TextBounds.Top;
SetBounds(TextBounds);
FPanel.Width := 200;
FPanel.ParentBackground := False;
// usefull but looks ugly:
@@ -1145,9 +1144,27 @@ end;
procedure TColumnDefaultEditorLink.SetBounds(R: TRect); stdcall;
var
TreeBottom, TreeRight,
PanelTop, PanelLeft: Integer;
TreeRect: TRect;
begin
FPanel.Top := R.Top;
FPanel.Left := R.Left;
TreeRect := FTree.BoundsRect;
PanelTop := R.Top;
TreeBottom := TreeRect.Bottom - TreeRect.Top -
(FTree as TVirtualStringtree).Header.Height - 20; // Column header and scrollbar
if R.Top + FPanel.Height > TreeBottom then
PanelTop := Max(0, TreeBottom - FPanel.Height);
PanelLeft := R.Left;
TreeRight := TreeRect.Right - TreeRect.Left - 20;
mainform.LogSQL(inttostr(treeright));
if R.Left + FPanel.Width > TreeRight then
PanelLeft := Max(0, TreeRight - FPanel.Width);
FPanel.Top := PanelTop;
FPanel.Left := PanelLeft;
end;