Einzelnen Beitrag anzeigen

Gutelo

Registriert seit: 29. Sep 2013
152 Beiträge
 
#2

AW: Problem mit GridPanel

  Alt 3. Okt 2013, 12:05
Mein Nachtrag scheint in die richtige Richtung zu gehen, denn das folgende funktioniert tadellos:

Code:
Procedure AddRadioItems(TG : TGridPanel);
var RB : Array[2..6,2..6] of TCheckBox;
    i,j: Integer;
begin
   TG.ControlCollection.BeginUpdate;
   for i := 2 to 6 do
    for j := 2 to 6 do
    begin
      RB[i,j] := TCheckbox.Create(TG);
      RB[i,j].Parent := TG;
      RB[i,j].caption := inttostr(i) + ' if ' + inttostr(j);
      RB[i,j].name := 'RB' + inttostr(i) + 'if' + inttostr(j);
      RB[i,j].enabled := false;
      if j>=i then RB[i,j].visible := true else RB[i,j].visible := false;
      TG.ControlCollection.Items[TG.ControlCollection.Count-1].Column := j-2;
      TG.ControlCollection.Items[TG.ControlCollection.Count-1].Row := i-2;
    end;
   TG.ControlCollection.EndUpdate;
end;
Dann geht auf einmal auch das direkte Setzen von row und column via AddControl

Geändert von Gutelo ( 3. Okt 2013 um 12:08 Uhr)
  Mit Zitat antworten Zitat