PDA

View Full Version : DBGrid Events? (I am lost)


FreakAzoid
09-12-2001, 06:44 AM
Here is the situation...
column1 column2 column3
row1 xxx yyy zzz
row2 xxx aaa bbb
row3 xxx yyy ccc

[button1]

the grid is tied to a datasource/interbase dataset(sql).
the selectrow is set to true so that when the grid is displayed a row is already selected. as the user clicks on the row header or down/up arrows the current row selection changes. I want to change the enabled status of button1 based upon the current value of column2. But I can't seem to find an event that fires when I press the rowheader or the down/up arrows. Yes I know of the mouseup and key down/up/press BUT am really looking for a better solution.

Thanks...

LörAn
09-12-2001, 06:52 AM
Why not trying to work with your DataSet ?
For example :
put an invisible TDBEdit linked to th same dataset and to your KeyField (or your column2 field).
On its OnChange event, you can manage your button like this :

if DataSet1.Active then begin
Button1.Enabled := (DataSet1.FieldByName('MyField').asString = 'OK);

or begin with something like that...
;)

LörAn.
MAIL: loran@superheros.as
ICQ : 112714184

FreakAzoid
09-12-2001, 07:02 AM
Thank you...
Sounds like a pretty simple solution....