Autor Beitrag
Ice
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 114



BeitragVerfasst: Fr 20.12.02 11:08 
Hallo!

Nachdem ich die Hürde mit dem überschreiben genommen habe hier nun das nächste Problem:

Ich versuche mit folgendem Quelltext:
ausblenden Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
Constructor TMyKomp1.Create(Owner: TComponent);
begin
  Inherited Create(Owner);
  unten := TPanel.Create(Owner);
  unten.Name := 'unten';
  unten.Height := 30;
  unten.Width  := 30;
  Seite1 := TPanel.Create(Owner);
  seite1.Name := 'Seite1';
  Seite1.Caption := '1';
  Seite1.Height  := 3;
  Seite1.Width   := 30;
  Seite2 := TPanel.Create(Owner);
  Seite2.Name := 'Seite2';
  Seite2.Caption := '2';
  Seite2.Height  := 24;
  Seite2.Width   := 3;
  Seite3 := TPanel.Create(Owner);
  Seite3.Name := 'Seite3';
  Seite3.Caption := '3';
  Seite3.Height  := 3;
  Seite3.Width   := 30;
  Seite4 := TPanel.Create(Owner);
  Seite4.Name := 'Seite4';
  Seite4.Caption := '4';
  Seite4.Height  := 24;
  Seite4.Width   := 3;
end;

eine Art karton nachzubilden, mein Problem dabei ist das die Panels zwar erzeugt werden jedoch nicht in der angegebenen Größe und auch nicht als teil von TMyKomp sondern als eigenständige Komponenten.

Könnt ihr mir da helfen?
Vielen Dank im voraus!

Ice

(20.12. 10:42 Tino) Code-Tags hinzugefügt.
Tino
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Veteran
Beiträge: 9839
Erhaltene Danke: 45

Windows 8.1
Delphi XE4
BeitragVerfasst: Fr 20.12.02 11:48 
Hallo Ice,

warum sollte die Komponenten denn auch Bestandteil Deiner Komponente sein? Wo hast Du das denn angegeben?

Ich würde es so machen:
ausblenden volle Höhe Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
Constructor TMyKomp1.Create (Owner: TComponent); 
Begin 
  Inherited Create(Owner); 

  unten := TPanel.Create(Self); 
  With unten do
    Begin
      Parent := Self;
      Height := 30; 
      Width := 30; 
    End;

  Seite1 := TPanel.Create (Self); 
  With Seite1 Do
    Begin
      Parent := Self;
      Seite1.Caption := '1'; 
      Height := 3; 
      Width := 30; 
    End;

  Seite2 := TPanel.Create(Owner); 
  With Seite2 Do
    Begin
      Parent := Self;
      Caption := '2'; 
      Height := 24; 
      Width := 3; 
    End;

  Seite3 := TPanel.Create(Self); 
  With Seite3 Do
    Begin
      Parent := Self;
      Caption := '3'; 
      Height := 3; 
      Width := 30; 
    End;

  Seite4 := TPanel.Create (Self); 
  With Seite4 Do
    Begin
      Parent := Self;
      Caption := '4'; 
      Height := 24; 
      Width := 3; 
    End;
End;

Nicht vergessen die Komponenten die Du im Constructor erstellt hast wieder im Destructor freizugeben!

Gruß
TINO
Ice Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 114



BeitragVerfasst: Fr 20.12.02 11:56 
Alles klar , Vielen Dank für die Hilfe.


Ice