Delphi Pages Forums  

Go Back   Delphi Pages Forums > Delphi Forum > DB-Aware

Lost Password?

Reply
 
Thread Tools Display Modes
  #1  
Old 07-26-2001, 06:47 PM
AlMack AlMack is offline
Junior Member
 
Join Date: Jul 2001
Posts: 14
Default Trapping DBGrid Movement Between Columns

I have a dbgrid attached to a table. There are 5 fields on the grid. When I insert a new record in the grid, and input the number '370' into the first field, I want to trap the event moving into the next column, so I can automatically insert 2 values into 2 of the other columns.

How can I achieve this?

Thanks!
Reply With Quote
  #2  
Old 07-26-2001, 09:28 PM
LörAn LörAn is offline
Senior Member
 
Join Date: Mar 2001
Posts: 1,506
Default RE: Trapping DBGrid Movement Between Columns

Maybe you can try using your DBGrid's OnColExit() (or OnColEnter()) event :

procedure DBGrid1ColExit(Sender: TObject);
begin
if ((Sender as TDBGrid).DataSource.DataSet.FieldByName('Field1'). asString = '370') then begin
((Sender as TDBGrid).DataSource.DataSet.FieldByName('Field2'). asString := 'Val2';
[...]
end;
end;


LörAn.
ICQ #112714184
Reply With Quote
  #3  
Old 07-26-2001, 11:53 PM
LörAn LörAn is offline
Senior Member
 
Join Date: Mar 2001
Posts: 1,506
Default RE: RE: Precision

Just a precision :
maybe you'll have to call the (Sender as TDBGrid).DataSource.DataSet.Edit() procedure before changing the other columns values.
But I think you have already noticed that...


LörAn.
ICQ #112714184
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 01:15 PM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2013, vBulletin Solutions, Inc.