Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- implementation
- {$R *.dfm}
- type
- THackDBGrid = class(TDBGrid);
- //for info on why we must do this, see:
- //http://delphi.about.com/od/oopindelphi/l/aa082603a.htm
- var
- LastValidRow: integer;
- procedure TForm1.DataSource1DataChange(Sender: TObject; Field: TField);
- begin
- //assign this to the TDBGrid.DataSource.DataSet.OnDataChange Event
- if 0 <> HiWord(GetKeyState(VK_LBUTTON)) then begin
- THackDBGrid(DBGrid1).Row := LastValidRow;
- end
- else begin
- LastValidRow := THackDBGrid(DBGrid1).Row;
- inherited;
- end;
- end;
Add Comment
Please, Sign In to add comment