Fix bug #696 Problem with popup editor editing the last record.

Solution: Always center the memo editor within the grid.
This commit is contained in:
Ansgar Becker
2008-08-26 05:56:43 +00:00
parent d8f5674b3d
commit 7e2897ebcf
2 changed files with 7 additions and 7 deletions

View File

@@ -171,9 +171,7 @@ end;
procedure TMemoEditorLink.SetBounds(R: TRect); stdcall;
begin
// Sets the top left corner of the edit control
if not FStopping then
FForm.TopLeft := R.TopLeft;
// See OnFormShow in the form object itself
end;

View File

@@ -29,7 +29,6 @@ type
{ Private declarations }
public
{ Public declarations }
TopLeft: TPoint; // Used to position this form on the top left corner of the edited cell
end;
@@ -55,15 +54,18 @@ end;
procedure TfrmMemoEditor.FormShow(Sender: TObject);
var
Tree: TCustomVirtualStringTree;
begin
Tree := TCustomVirtualStringTree(Parent);
// Hide window caption
SetWindowLong(Handle, GWL_STYLE, GetWindowLong( Handle, GWL_STYLE ) and not WS_CAPTION );
// Restore form dimensions
Width := Mainform.GetRegValue(REGNAME_MEMOEDITOR_WIDTH, DEFAULT_MEMOEDITOR_WIDTH);
Height := Mainform.GetRegValue(REGNAME_MEMOEDITOR_HEIGHT, DEFAULT_MEMOEDITOR_HEIGHT);
// Set top left corner to match the edited cell
Left := TopLeft.X;
Top := TopLeft.Y;
// Center the form in the grid
Left := (Tree.Width - Width) div 2;
Top := (Tree.Height - Height) div 2;
// Fix label position:
lblTextLength.Top := tlbStandard.Top + (tlbStandard.Height-lblTextLength.Height) div 2;
SetWindowSizeGrip(Handle, True);