Hola Luvac.
El código funciona correctamente en Delphi 7 pero tal vez no lo haga en Delphi XE4... En realidad todo el embrollo de reescribir
TInplaceEdit era a fin de que también pusiera el texto en rojo cuando editaras, pero no es relevante para la seleccion de la fila.
Anulando esa parte del código y usando sólo los eventos del StringGrid supongo que tendría funcionarte en XE4 :
Código Delphi
[-]
...
implementation
var
RowSelected: Integer;
procedure TForm1.StringGrid1Enter(Sender: TObject);
begin
RowSelected:= 0;
end;
procedure TForm1.StringGrid1DrawCell(Sender: TObject; ACol, ARow: Integer;
Rect: TRect; State: TGridDrawState);
const
ROWCOL : array[Boolean] of TColor = (clBlack, clRed);
begin
with TStringGrid(Sender) do
begin
Canvas.Font.Color:= ROWCOL[ARow = RowSelected];
Canvas.TextOut(Rect.Left+2, Rect.Top+2, Cells[Acol,ARow]);
end;
end;
procedure TForm1.StringGrid1SelectCell(Sender: TObject; ACol,
ARow: Integer; var CanSelect: Boolean);
begin
with TStringGrid(Sender) do
begin
RowSelected:= ARow;
Invalidate;
end;
end;
Saludos