 |
|
EnterpriseDBDAC
Example: MoveBy, SelectedIndex, Tag | | Previous Next |
The following example enables the user to move the current selected cell in a dbgrid. The Up and Down buttons have their OnClick events assigned to the
UpDownClick procedure. The Left and Right buttons have their OnClick events assigned to the
LeftRightClick procedure. The Up and Left buttons have their Tag property set to –1, while
the Down and Right buttons have their Tag property set to 1.
procedure TForm1.UpDownClick(Sender: TObject);
begin
EDBTable1.MoveBy(TComponent(Sender).Tag);
DBGrid1.SetFocus;
end;
procedure TForm1.LeftRightClick(Sender: TObject);
begin
DBGrid1.SelectedIndex := DBGrid1.SelectedIndex + TComponent(Sender).Tag;
DBGrid1.SetFocus;
end;
|