Einzelnen Beitrag anzeigen

Benutzerbild von APP
APP

Registriert seit: 24. Feb 2003
Ort: Graz (A)
705 Beiträge
 
Delphi 7 Enterprise
 
#3

Re: schleife für radiogroup-controls

  Alt 24. Okt 2003, 21:24
Hallo Christoph,
mal so richig Q&D:

Delphi-Quellcode:
PROCEDURE TForm1.Button2Click(Sender: TObject);
   PROCEDURE DisableRGItems(comp: TComponent; rg: TRadioGroup);
   VAR
      k, i : integer;
      a : Tcomponent;
   BEGIN
      FOR k := 0 TO comp.ComponentCount - 1 DO
         BEGIN
            a := comp.components[k];
            IF a.classType = TRadioGroup THEN
               WITH (a AS TRadioGroup) DO
                  IF rg.Name = a.Name THEN
                     FOR i := 0 TO Items.Count - 1 DO
                        IF ItemIndex <> i THEN
                           Controls[i].Enabled := false;
         END;
   END;
BEGIN
   // 1. Parameter ist die Form, 2. Die Radiogroup
   DisableRGItems(self, RadioGroup1);
END;
p.s. Wenn kein Item angewählt ist, werden alle Disabled
Armin P. Pressler

BEGIN
...real programmers are using C/C++ - smart developers Delphi;
END;
  Mit Zitat antworten Zitat