Klasse properties
-
class MyItem: public TStaticText { } class MyContainer: public TPanel { protected: MyItem GetItem( int nIndex ); public: __fastcall MyContainer( TComponent* Owner ); __fastcall ~MyContainer(); __property MyItem Items[ int nIndex ] = { read = GetItem default }; // zeile 64 };
[BCC32 Error] MyContainer.h(64): E2459 VCL style classes must be constructed using operator new
ich habe hier Problem mit property, wie loese ich da am besten?
-
Hallo
Deine Klasse MyItem ist von TObject abgeleitet. Deshalb kann die VCL diese Klasse nur als Typ für eine Property verwenden, wenn die Property als Zeiger auf Klassentyp definiert ist. (Und natürlich auch alle dazugehörigen Elemente entsprechend angepassert werden
bis bald
Stefan