I have a form with several controls where the first one is a TDBCheckBox
that is bound to DataField := 'enabled'
.
When the checkbox is clicked I want all the remaining controls to be enabled / disabled.
procedure TMyAdapter.DataSourceDataChange(Sender: TObject; Field: TField);
var
Enabled: Boolean;
begin
Enabled := FModel.DataSet['enabled'].AsBoolean;
FView.Label1.Enabled := Enabled;
FView.DBEdit1.Enabled := Enabled;
FView.Label2.Enabled := Enabled;
FView.DBEdit2.Enabled := Enabled;
FView.Label3.Enabled := Enabled;
FView.DBEdit3.Enabled := Enabled;
FView.Label4.Enabled := Enabled;
FView.DBEdit4.Enabled := Enabled;
end;
This only works when the focus leaves the checkbox or when the dataset is scrolled (I have a navigator on this form as well).
Is there a way to make the checkbox update its datafield immediately?
Or is there even a better alternative to achieve what I have described?
Aucun commentaire:
Enregistrer un commentaire