Hi
I have a problem with a custom TStringGrid. The Grid is created at runtime and the constructor is as follows:
constructor TMyGrid.Create(TheOwner: TComponent);
begin
inherited Create(TheOwner);
FixedCols := 0;
FixedRows := 0;
GridLineWidth := 1;
Options := [goFixedVertLine, goFixedHorzLine, goVertLine, goEditing];
Options := Options + [goRowHighlight, goRowSelect];
ScrollBars := ssAutoBoth;
RowCount := 0;
ColCount := 2;
with Columns.Add do
begin
ReadOnly := true;
Alignment := taRightJustify;
Color := clBtnFace;
end;
with Columns.Add do
begin
ReadOnly := false;
Alignment := taLeftJustify;
end;
DefaultRowHeight := Font.GetTextHeight('Tg');
end;
So far so good.
The problem is that when I select a cell for editing by pressing the Enter key, the editor shows up correctly, but the text is fully selected and cannot use the lef and right keys to move within the editor. Infact, if I use those keys the grid selects another cell (left or right of that one).
If I instead click on the selected editor text all goes well and I can move around the text in the editor.
Also: if I press enter on a cell to edit it, the OnEditingDone event is fired twice: at the beginning of the edit and at the end. If, instead, I click the cell to edit it, OnEditingDone is (correctly) fired once, i.e. at the end of the edit.
Is there anything I'm missing here?
Thanks