PDA

Ver la Versión Completa : Generar "scroll horizontal" con los cursores en un Grid


dec
30-06-2006, 23:21:02
Pon el siguiente codigo en el evento KeyDown de tu Grid.

NOTA: Solo funcionara si el la property Options tienen RowSelect := TRUE.


procedure TDBGrid1.KeyDown(var Key: Word; Shift: TShiftState);
begin
{Scroll con los cursores cuando tiene RowSelect}
if dgRowSelect in Options then
if Key in [VK_LEFT,VK_RIGHT] then
begin

if Key = VK_LEFTthen
if (ssCtrl in Shift) then Perform (WM_HSCROLL,SB_PAGELEFT,0)
else Perform(WM_HSCROLL,SB_LINELEFT,0);

if key = VK_RIGHT then
if (ssCtrl in Shift) then Perform(WM_HSCROLL,SB_PAGERIGHT,0)
else Perform(WM_HSCROLL,SB_LINERIGHT,0);

end;
Key:= 0;
end;
end;