Einzelnen Beitrag anzeigen

Susanne

Registriert seit: 21. Mai 2004
Ort: Lage
232 Beiträge
 
Delphi 2005 Professional
 
#12

Re: Combobox-abhängig - Checkbox auf true setzen

  Alt 14. Dez 2006, 12:16
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;
Susanne
  Mit Zitat antworten Zitat