Skip to content

Commit 8d119a0

Browse files
committed
fix: bad position of TEdit on TInplaceEditorLink
1 parent 8696e61 commit 8d119a0

File tree

1 file changed

+16
-6
lines changed

1 file changed

+16
-6
lines changed

source/grideditlinks.pas

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1181,16 +1181,31 @@ constructor TInplaceEditorLink.Create(Tree: TVirtualStringTree; AllowEdit: Boole
11811181
FEdit.Parent := FPanel;
11821182
FEdit.ParentColor := True;
11831183
FEdit.BorderStyle := bsNone;
1184+
FEdit.AnchorSideLeft.Control := FPanel;
1185+
FEdit.AnchorSideTop.Control := FPanel;
1186+
FEdit.AnchorSideBottom.Control := FPanel;
1187+
FEdit.AnchorSideBottom.Side := asrBottom;
1188+
FEdit.Anchors := [akTop, akLeft, akRight, akBottom];
11841189
FEdit.OnKeyDown := DoKeyDown;
11851190
FMainControl := FEdit;
11861191

11871192
FButton := TButton.Create(FPanel);
11881193
FButton.Parent := FPanel;
1194+
FButton.AnchorSideLeft.Side := asrBottom;
1195+
FButton.AnchorSideTop.Control := FPanel;
1196+
FButton.AnchorSideRight.Control := FPanel;
1197+
FButton.AnchorSideRight.Side := asrBottom;
1198+
FButton.AnchorSideBottom.Control := FPanel;
1199+
FButton.AnchorSideBottom.Side := asrBottom;
1200+
FButton.Anchors := [akTop, akRight, akBottom];
1201+
FButton.Constraints.MaxWidth := TExtForm.ScaleSize(20, FPanel);
11891202
FButton.TabStop := False;
11901203
FButton.Caption := '...';
11911204
FButton.Hint := _('Edit text in popup editor ...');
11921205
FButton.ShowHint := True;
11931206
FButton.OnClick := ButtonClick;
1207+
1208+
FEdit.AnchorSideRight.Control := FButton;
11941209
end;
11951210

11961211
destructor TInplaceEditorLink.Destroy;
@@ -1285,12 +1300,7 @@ procedure TInplaceEditorLink.SetBounds(R: TRect);
12851300
if not FStopping then begin
12861301
// Position edit control according to cell text bounds
12871302
FPanel.BoundsRect := GetCellRect(False);
1288-
R := GetCellRect(True);
1289-
if FButton.Visible then
1290-
Dec(R.Right, TExtForm.ScaleSize(20, FPanel));
1291-
FEdit.BoundsRect := R;
1292-
1293-
FButton.BoundsRect := Rect(FEdit.BoundsRect.Right, 0, FPanel.Width, FPanel.Height);
1303+
// R is too big in a grid, for some reason
12941304
end;
12951305
end;
12961306

0 commit comments

Comments
 (0)