Klasse mit TEdit Feldern erstellen
-
Hallo,
ich möchte eine Klasse erstellen die mir TEdit Felder auf meiner MainForm erzeugt.
Mein Problem besteht darin dass ich nicht weiss wie ich das TEdit Feld initialisieren soll. So wie ich es gemacht habe in der Header Datei geht das ja nicht, aber wo oder wie dann?
Genauso wollte ich noch fragen wie ich den Parent übergeben kann, geht das einfach als string?
Bin bisher so weit:
class Column{ private: TEdit *variable = new TEdit(); public: Column(int top, int left, string parent){ variable->Name = "variable"; variable->Top = top; variable->Left = left; variable->Parent = parent; }; ~Column(){}; };
-
Hallo
Zum Initialisieren ist der Konstruktor da.
Parent übergibst du als TWinControl.class Column{ private: TEdit *variable; public: Column(int top, int left, TWinControl* parent){ variable = new TEdit(parent); variable->Parent = parent; variable->Name = "variable"; variable->Top = top; variable->Left = left; variable->Parent = parent; }; ~Column(){}; };bis bald
akari
-
Vielen Danke, hat funktioniert.

-
WS schrieb:
Vielen Danke, hat funktioniert.

Ich bin so überrascht gewesen dass ich nicht mal mehr "Dank" schreiben konnte.
p.s.: Sorry für Doppelpost und der Thread kann als gelöst (für mein Problem) markiert werden.
-
Sorry muss nochmal nerven aber ich bekomm da doch Fehler:
[C++ Fehler] Column.h(10): E2303 Typname erwartet
[C++ Fehler] Column.h(10): E2139 In Deklaration fehlt ;
[C++ Fehler] Column.h(14): E2303 Typname erwartet//--------------------------------------------------------------------------- #ifndef ColumnH #define ColumnH #include <system.hpp> class Column{ private: TEdit *variable; public: Column(int top, int left, TWinControl* parent){ variable = new TEdit(parent); variable->Parent = parent; variable->Name = "variable"; variable->Top = top; variable->Left = left; variable->Parent = parent; }; ~Column(){}; };
-
Hallo
#include <vcl.h>anstelle von dem system.hpp
bis bald
akari
-
Superb!
