...das Scrollen in einem DBGrid einschalten?

Autor: Mato

Kategorie: Datenbanken

{ - Here is tip how to scroll DBGrid -}

//...
private
  
OldGridProc: TWndMethod;
  procedure GridWindowProc(var Message: TMessage);
//...

procedure TForm1.FormCreate(Sender: TObject);
begin
  
OldGridProc        := DBGrid1.WindowProc;
  DBGrid1.WindowProc := GridWindowProc;
end;

procedure TForm1.GridWindowProc(var Message: TMessage);
var
  
Pos: SmallInt;
begin
  
OldGridProc(Message);
  if Message.Msg = WM_VSCROLL then  //or WM_HSCROLL
  
begin
    
Pos          := Message.WParamHi;  //Scrollbox position
    
Table1.RecNo := Pos;
  end;
end;

 

printed from
www.swissdelphicenter.ch
developers knowledge base