From 8ca38b4e4840a8d8759c5abe42f7fe7095e1e54c Mon Sep 17 00:00:00 2001 From: Ansgar Becker Date: Sat, 6 Jun 2009 06:12:34 +0000 Subject: [PATCH] Fix issue #1161: Enum editor pops up in the upper left corner --- source/grideditlinks.pas | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/source/grideditlinks.pas b/source/grideditlinks.pas index 94f15530..d875b1d9 100644 --- a/source/grideditlinks.pas +++ b/source/grideditlinks.pas @@ -538,6 +538,7 @@ end; function TEnumEditorLink.PrepareEdit(Tree: TBaseVirtualTree; Node: PVirtualNode; Column: TColumnIndex): Boolean; stdcall; var i: Integer; + CellRect: TRect; begin Result := Tree is TCustomVirtualStringTree; if not Result then @@ -545,8 +546,12 @@ begin Ftree := Tree as TCustomVirtualStringTree; FNode := Node; FColumn := Column; - FCombo := TTnTComboBox.Create(Tree); + FCombo := TTnTComboBox.Create(FTree); FCombo.Parent := FTree; + + CellRect := Ftree.GetDisplayRect(FNode, FColumn, False); + FCombo.BoundsRect := CellRect; + FCombo.ItemHeight := CellRect.Bottom - CellRect.Top - 4; for i := 0 to ValueList.Count - 1 do FCombo.Items.Add(ValueList[i]); if AllowCustomText then begin @@ -569,8 +574,8 @@ end; procedure TEnumEditorLink.SetBounds(R: TRect); stdcall; begin - FCombo.BoundsRect := R; - FCombo.ItemHeight := R.Bottom - R.Top - 4; + FCombo.BoundsRect := Ftree.GetDisplayRect(FNode, FColumn, False); + FCombo.ItemHeight := FCombo.BoundsRect.Bottom - FCombo.BoundsRect.Top - 4; end;