EhLib.Com
https://forum.ehlib.com/en/

DBGridEh - Edit in Cell - Use own Update- Qry
https://forum.ehlib.com/en/viewtopic.php?f=5&t=1188
Page 1 of 1

Author:  MichaelJ [ 28 Nov 2022, 11:15 ]
Post subject:  DBGridEh - Edit in Cell - Use own Update- Qry

Hi,

I want to edit and Update a a DBGridEh-cell and want to use a own Update Qry to save the data in the database. DBGridEh is bind to this own dataset.
Which are the right Events to do this? (Read Input data and Update Data in database)

The worflow shoud be used like:
1. Edit a value in a Column (Amount)
2. press return => Start Update-Qry and Jump to next cell (down) in Column (Amount)

Author:  EhLibSupport [ 30 Nov 2022, 11:31 ]
Post subject:  Re: DBGridEh - Edit in Cell - Use own Update- Qry

Hello

Try to use TColumnEh.OnUpdateData event:

Here is an example:

Code:
procedure TForm1.DBGridEh1Columns3UpdateData(Sender: TObject; var Text: string;
  var Value: Variant; var UseText, Handled: Boolean);
var
  Column: TDBGridColumnEh;
begin
  Column := Sender as TDBGridColumnEh;

  Column.Field.DataSet.Edit;
  Column.Field.Text := Text;
  Column.Field.DataSet.Post;

  Handled := True;
end;

Page 1 of 1 All times are UTC
Powered by phpBB® Forum Software © phpBB Group
http://www.phpbb.com/