Как написать так, чтобы при снятии флажка checkbox все радиокнопки приняли значение enabled := false?
1 ответ
Если все радио-кнопки на форме надо погасить, то:
procedure TForm1.CheckBox1Click(Sender: TObject);
var i: Integer;
begin
if not TCheckBox(Sender).Checked then
for i:=0 to ComponentCount-1 do
if Components[i] is TRadioButton then
TRadioButton(Components[i]).Enabled:=False;
end;
Если, лежащие на какой-то панели (TWinControl'е), то:
procedure TForm1.CheckBox1Click(Sender: TObject);
var i: Integer;
begin
if not TCheckBox(Sender).Checked then
for i:=0 to Panel1.ControlCount-1 do
if Panel1.Controls[i] is TRadioButton then
Panel1.Controls[i].Enabled:=False;
end;