1

In my cxGrid I have a Yes/No field which is by default 'NO' . Next to that field, I have another field,a LookupComboBox field that gets its values from another table. It is empty by default however I would like that, when the value gets changed in this particular field, my Yes/No field should change to 'YES' (Only in the row that I am currently editing) How am I to do this ? Also Not sure where to implement the code ....OnChange,Oneditvaluechanged,Onvalidate ???

4

1 回答 1

1

Since your grid semms to be bound on datasets one easy way would be using the fieldchange event of your selection field.
For immediate behavior you should use a TcxEditRepositoryLookupComboBoxItem with ImmediatePost instead a of a Lookupfield in your dataset (which would anyway the worse approach with at least ADO)

procedure TForm4.MainSelectionChange(Sender: TField);
begin

   if Main.State in [dsEdit,dsInsert] then
      if not Sender.IsNull then
        MainYesNo.Value := true;

   { maybe you are looking for that instead the code above
   if Main.State in [dsEdit,dsInsert] then
        MainYesNo.Value := not Sender.IsNull
   }
end;

Lookup definition Lookupusage

于 2013-03-31T20:14:45.100 回答