Foros Club Delphi

Foros Club Delphi (https://www.clubdelphi.com/foros/index.php)
-   Trucos (https://www.clubdelphi.com/foros/forumdisplay.php?f=52)
-   -   Generar "scroll horizontal" con los cursores en un Grid (https://www.clubdelphi.com/foros/showthread.php?t=80634)

dec 30-06-2006 23:21:02

Generar "scroll horizontal" con los cursores en un Grid
 
Pon el siguiente codigo en el evento KeyDown de tu Grid.

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

Código Delphi [-]
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;


La franja horaria es GMT +2. Ahora son las 14:35:29.

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Traducción al castellano por el equipo de moderadores del Club Delphi