Einzelnen Beitrag anzeigen

Benutzerbild von Pseudemys Nelsoni
Pseudemys Nelsoni

Registriert seit: 24. Dez 2002
Ort: Hamburg-Harburg
3.551 Beiträge
 
#1

Komponenten eines Arrays löschen

  Alt 23. Jan 2004, 23:04
hoi,

ich hab ne menge komponenten zur laufzeit erstellt (in einem array)


Delphi-Quellcode:
      Chan[high(Chan)].TS := TTabSheet.Create(self);
      with Chan[high(Chan)].TS do
      begin
        Name := Chan[high(Chan)].Channame + 'TS';
        Parent := PageControl1;
        Caption := Chan[high(Chan)].CName;
        PageControl := PageControl1;
        Show;
      end;
      Chan[high(Chan)].HauptPan := TPanel.Create(self);
      with Chan[high(Chan)].HauptPan do
      begin
        Name := Chan[high(Chan)].Channame + 'HauptPan';
        Parent := Chan[high(Chan)].TS;
        Width := Chan[high(Chan)].TS.Width-16;
        Height := Chan[high(Chan)].TS.Height-16;
        Left := 8;
        Top := 8;
        BevelOuter := bvNone;
        Caption := '';
        Anchors := [akLeft, akTop, akRight, AkBottom];
        Show;
      end;
      Chan[high(Chan)].TBPan := TPanel.Create(self);
      with Chan[high(Chan)].TBPan do
      begin
        Name := Chan[high(Chan)].Channame + 'TBPan';
        Parent := Chan[high(Chan)].HauptPan;
        Width := Chan[high(Chan)].HauptPan.Width;
        Height := 45;
        Align := alBottom;
        Caption := '';
        Anchors := [akLeft, akTop, akRight];
        BevelOuter := bvNone;
        Show;
      end;
      Chan[high(Chan)].UBPan := TPanel.Create(self);
      with Chan[high(Chan)].UBPan do
      begin
        Name := Chan[high(Chan)].Channame + 'UBPan';
        Parent := Chan[high(Chan)].HauptPan;
        Width := 146;
        Height := Chan[high(Chan)].HauptPan.Height;
        Align := alRight;
        Caption := '';
        Anchors := [akTop, akRight, akbottom];
        BevelOuter := bvNone;
        Show;
      end;
      Chan[high(Chan)].Splitter := TSplitter.Create(self);
      with Chan[high(Chan)].Splitter do
      begin
        Name := Chan[high(Chan)].Channame + 'Splitter';
        Parent := Chan[high(Chan)].HauptPan;
        MinSize := 100;
        Align := alRight;
        Show;
      end;
      Chan[high(Chan)].CBPan := TPanel.Create(self);
      with Chan[high(Chan)].CBPan do
      begin
        Name := Chan[high(Chan)].Channame + 'CBPan';
        Parent := Chan[high(Chan)].HauptPan;
        Align := alClient;
        Caption := '';
        Anchors := [akLeft, akTop, akRight, akBottom];
        BevelOuter := bvNone;
        Show;
      end;
      Chan[high(Chan)].TBGroup := TGroupbox.Create(self);
      with Chan[high(Chan)].TBGroup do
      begin
        Name := Chan[high(Chan)].Channame + 'TBGroup';
        Parent := Chan[high(Chan)].TBPan;
        Width := Chan[high(Chan)].TBPan.Width;
        Height := Chan[high(Chan)].TBPan.Height;
        Left := 0;
        Top := 0;
        Caption := 'Textbox';
        Anchors := [akLeft, akTop, akRight];
        Show;
      end;
      Chan[high(Chan)].UBGroup := TGroupbox.Create(self);
      with Chan[high(Chan)].UBGroup do
      begin
        Name := Chan[high(Chan)].Channame + 'UBGroup';
        Parent := Chan[high(Chan)].UBPan;
        Width := Chan[high(Chan)].UBPan.Width;
        Height := Chan[high(Chan)].UBPan.Height;
        Left := 0;
        Top := 0;
        Caption := 'Userbox';
        Anchors := [akLeft, akTop, akRight, akBottom];
        Show;
      end;
      Chan[high(Chan)].CBGroup := TGroupbox.Create(self);
      with Chan[high(Chan)].CBGroup do
      begin
        Name := Chan[high(Chan)].Channame + 'CBGroup';
        Parent := Chan[high(Chan)].CBPan;
        Width := Chan[high(Chan)].CBPan.Width;
        Height := Chan[high(Chan)].CBPan.Height;
        Left := 0;
        Top := 0;
        Caption := 'Userbox';
        Anchors := [akLeft, akTop, akRight, akBottom];
        Show;
      end;
      Chan[high(Chan)].Textbox := TEdit.Create(self);
      with Chan[high(Chan)].Textbox do
      begin
        Name := Chan[high(Chan)].Channame + 'Textbox';
        Parent := Chan[high(Chan)].TBGroup;
        Width := Chan[high(Chan)].TBGroup.Width-16;
        Height := Chan[high(Chan)].TBGroup.Height-23;
        Left := 8;
        Top := 15;
        Text := '';
        Color := clBlack;
        Anchors := [akLeft, akTop, akRight];
        Show;
      end;
      Chan[high(Chan)].Userbox := TListbox.Create(self);
      with Chan[high(Chan)].Userbox do
      begin
        Name := Chan[high(Chan)].Channame + 'Userbox';
        Parent := Chan[high(Chan)].UBGroup;
        Width := Chan[high(Chan)].UBGroup.Width-16;
        Height := Chan[high(Chan)].UBGroup.Height-23;
        Left := 8;
        Top := 15;
        Color := clBlack;
        Anchors := [akTop, akLeft, akRight, akbottom];
        Show;
      end;
      Chan[high(Chan)].Chatbox := TRichEdit.Create(self);
      with Chan[high(Chan)].Chatbox do
      begin
        Name := Chan[high(Chan)].Channame + 'Chatbox';
        Parent := Chan[high(Chan)].CBGroup;
        Width := Chan[high(Chan)].CBGroup.Width-16;
        Height := Chan[high(Chan)].CBGroup.Height-23;
        Left := 8;
        Top := 15;
        Chan[high(Chan)].Chatbox.Text := '';
        Color := clBlack;
        Anchors := [akLeft, akTop, akRight, akBottom];
        Show;
      end;

nur wie krieg ich die alle wieder weg?

wenn ich array := nil mache, ist das array wohl zwar weg, aber die komponenten noch alle auf der form, wie bekomm ich die weg?
Mario
  Mit Zitat antworten Zitat