Scroll within a DBGrid
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
//... 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; |