Pues el código que puse, en mi delphi 7 no hace cosas raras, no creo haber añadido nada mas que activar la tecla tab para que funcione como dice Casimiro.
Por si las moscas he realizado otra función para simular pulsaciones, mas acorde con el S.O. usando la API
SendImput y que ya use en un ejemplo
aquí para simular clicks de ratón.
Código Delphi
[-]
procedure SimKey(VK: BYTE; Down: boolean);
var
Input: TInput;
begin
ZeroMemory(@Input, sizeof(Input));
Input.Tipo:= INPUT_KEYBOARD;
Input.ki.wVk:= VK;
Input.ki.wScan:= MapVirtualKey(VK, 0);
Input.ki.dwFlags:= KEYEVENTF_EXTENDEDKEY;
if not Down then
Input.ki.dwFlags:= Input.ki.dwFlags or KEYEVENTF_KEYUP;
windows.SendInput(1, tagINPUT(Input), sizeof(TInput));
end;
procedure TForm1.StringGrid1KeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
begin
if Key = VK_LEFT then
begin
SimKey(VK_SHIFT, true);
SimKey(VK_TAB, true);
SimKey(VK_SHIFT, false);
SimKey(VK_TAB, false);
Key := 0;
end;
if Key = VK_RIGHT then
begin
SimKey(VK_TAB, true);
SimKey(VK_TAB, false);
Key := 0;
end;
end;
Saludos.