DBGrid - rowselect e teclas left e right

Top  Previous  Next

Quando a propriedade RowSelect for TRUE e houver mais colunas que possam caber

na tela, como fazer um scroll horizontal pelo teclado?

 

procedure FormKeyDown

begin

  if Key = Vk_Right then

  begin

    SendMessage(Grid.Handle, WM_HSCROLL, SB_LINEDOWN, 0);

    Key := 0;

  end;

 

  if Key = Vk_Left then

  begin

    SendMessage(Grid.Handle, WM_HSCROLL, SB_LINEUP, 0);

    Key := 0;

  end;

end;