nach vielem Suchen und ausprobieren habe ich nun diese Lösung gefunden und die funktioniert jetzt:
Delphi-Quellcode:
procedure TForm2.ComboExit(Sender: TObject);
var
i, ii, iii : Integer;
Component : TComponent;
component2 : TComponent;
begin
if pos('Rechnung', TComboBox(Sender).Text) > 0 then begin
for i := low(a_chk) to high(a_chk) do
for ii := 0 to form2.ComponentCount - 1 do begin
Component := form2.Components[ii];
If( form2.Components[ii] is TGroupBox ) Then
for iii := 0 to form2.Components[ii].ComponentCount - 1 do begin
Component2 := form2.Components[ii].Components[iii];
if (Component2.Name =a_chk[i].Name) and (form2.Components[ii].Components[iii] is TCheckBox) then
TCheckBox(Component2).Checked:= true;
end;
end;
end else begin
for i := low(a_chk) to high(a_chk) do
for ii := 0 to form2.ComponentCount - 1 do begin
Component := form2.Components[ii];
If( form2.Components[ii] is TGroupBox ) Then
for iii := 0 to form2.Components[ii].ComponentCount - 1 do begin
Component2 := form2.Components[ii].Components[iii];
if (Component2.Name =a_chk[i].Name) and (form2.Components[ii].Components[iii] is TCheckBox) then
TCheckBox(Component2).Checked:= false;
end;
end;
end;
end;