Autor Beitrag
Marco D.
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 2750

Windows Vista
Delphi 7, Delphi 2005 PE, PHP 4 + 5 (Notepad++), Java (Eclipse), XML, XML Schema, ABAP, ABAP OO
BeitragVerfasst: Di 30.05.06 15:39 
Hallo,

ich schreibe mir gerade die Klasse TFile. Jede Instanz dieser Klasse soll über verschiedene Controls wie Edits, Labels, Buttons usw. verfügen. Muss ich dann im constructor jedes dieser Controls im Quellcode erstellen oder wie macht man sowas? Das Problem ist, dass ist ziemlich lästig, da es nicht nur ein paar Controls sind.

_________________
Pascal keeps your hand tied. C gives you enough rope to hang yourself. C++ gives you enough rope to shoot yourself in the foot
digi_c
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 1905

W98, XP
D7 PE, Lazarus, WinAVR
BeitragVerfasst: Mi 31.05.06 07:08 
Du kannst doch dem Projekt ein Formular hinzufügen und in der Klasse eine Instanz davon anlegen.
Aber Oberfläche und Logik zu vermischen ist nicht wirklich günstig aber vielleicht führt der Klassenname auch in die Irre...
Marco D. Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 2750

Windows Vista
Delphi 7, Delphi 2005 PE, PHP 4 + 5 (Notepad++), Java (Eclipse), XML, XML Schema, ABAP, ABAP OO
BeitragVerfasst: Mi 31.05.06 14:32 
user profile icondigi_c hat folgendes geschrieben:
Du kannst doch dem Projekt ein Formular hinzufügen und in der Klasse eine Instanz davon anlegen.

Hatte ich auch vor ;)
user profile icondigi_c hat folgendes geschrieben:

Aber Oberfläche und Logik zu vermischen ist nicht wirklich günstig aber vielleicht führt der Klassenname auch in die Irre...

Verstehe ich nicht. :gruebel:

_________________
Pascal keeps your hand tied. C gives you enough rope to hang yourself. C++ gives you enough rope to shoot yourself in the foot
digi_c
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 1905

W98, XP
D7 PE, Lazarus, WinAVR
BeitragVerfasst: Mi 31.05.06 14:54 
Bei TFile hatte ich an etwas gedacht, das z.B. ein Dokumenten ließt usw....
Du willst da aber auch einen Teild er GUI mit rein packen. Wenn man sowas zu sehr vermischt, riskiert man, dass man sehr viel ändern muss bei Umstellungen, die Klassen sollten immer ein wenig unabhängig sein.

Na dann kannst du doch das Formular ganz normal designen? Und im Klassenkonstruktor amchst du wie gesagt ne Instanz des Formulares und fertig. Kein manuelles herumgedocktor.
Marco D. Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 2750

Windows Vista
Delphi 7, Delphi 2005 PE, PHP 4 + 5 (Notepad++), Java (Eclipse), XML, XML Schema, ABAP, ABAP OO
BeitragVerfasst: Mi 31.05.06 14:56 
ALso das läuft so:
Ich habe in TForm1 eine PageControl. Dann habe ich die Klasse TFile. Immer wenn ich eine neue Instanz erzeuge, dann soll ein neuer Tab mit einer Menge Controls in der PageControl erscheinen. So kann man dann mehrere Dateien öffnen. Was gibts da zu sagen?

_________________
Pascal keeps your hand tied. C gives you enough rope to hang yourself. C++ gives you enough rope to shoot yourself in the foot