From d03ae628cc4fe0de1d95a020ce70882b3ad1f7a4 Mon Sep 17 00:00:00 2001 From: Ansgar Becker Date: Sun, 24 Feb 2013 10:13:26 +0000 Subject: [PATCH] Reposition default value editor so it's not outside the main form. Fixes issue #2868. --- source/grideditlinks.pas | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/source/grideditlinks.pas b/source/grideditlinks.pas index f4213525..53b3b0f5 100644 --- a/source/grideditlinks.pas +++ b/source/grideditlinks.pas @@ -1298,10 +1298,22 @@ end; procedure TColumnDefaultEditorLink.SetBounds(R: TRect); stdcall; var CellRect: TRect; + P: TPoint; + Room: Integer; begin CellRect := GetCellRect(False); FPanel.Left := CellRect.Left; FPanel.Top := CellRect.Top; + + // Reposition editor so it's not outside the main form + P := FParentForm.ClientToScreen(FPanel.BoundsRect.TopLeft); + Room := FParentForm.BoundsRect.Bottom - 8 {Borderwidth} - (P.Y + FPanel.Height); + if Room < 0 then + FPanel.Top := CellRect.Top + Room; + P := FParentForm.ClientToScreen(FPanel.BoundsRect.BottomRight); + Room := FParentForm.BoundsRect.Right - 8 {Borderwidth} - P.X; + if Room < 0 then + FPanel.Left := CellRect.Left + Room; end;