Board index » cppbuilder » Control '' has no parent window.
Emmanuel
CBuilder Developer |
Emmanuel
CBuilder Developer |
Control '' has no parent window.2004-11-08 11:08:29 AM cppbuilder5 I don't know why when I put my TComponent to a form it claim that Error :Control '' has no parent window. how can I solve it? |
Remy Lebeau (TeamB)
CBuilder Developer |
2004-11-08 05:21:52 PM
Re:Control '' has no parent window.
"Emmanuel" < XXXX@XXXXX.COM >wrote in message
QuoteI don't know why when I put my TComponent when the constructor is called. Please show your actual code. Gambit |
Emmanuel
CBuilder Developer |
2004-11-08 05:47:02 PM
Re:Control '' has no parent window.
"Remy Lebeau (TeamB)" < XXXX@XXXXX.COM >дÈëÓʼþ
Quote
#include "URDBRichEdit.h" #pragma package(smart_init) //-------------------------------------------------------------------------- - // ValidCtrCheck is used to assure that the components created do not have // any pure virtual functions. // static inline void ValidCtrCheck(TURDBRichEdit *) { new TURDBRichEdit(NULL); } //-------------------------------------------------------------------------- - __fastcall TURDBRichEdit::TURDBRichEdit(TComponent* Owner) : TDBRichEdit(Owner) {FColorReadOnly=clBtnFace; FColorEditable=clWhite; FReadOnly=TDBRichEdit::ReadOnly; Color=FReadOnly?FColorReadOnly:FColorEditable; AppendRight=true; EditRight=true; PrintRight=true; DeleteRight=true; } __fastcall TURDBRichEdit::~TURDBRichEdit() {URight=NULL; } void __fastcall TURDBRichEdit::SetReadOnly(bool value) {FReadOnly=value; TDBRichEdit::ReadOnly=FReadOnly; Color=FReadOnly?FColorReadOnly:FColorEditable; } void __fastcall TURDBRichEdit::SetURight(TURight*Value) {if(FURight==Value) {return; } if(FURight!=NULL) {FURight->DeleteComponent(this); } FURight=Value; if(FURight!=NULL) {FURight->AddComponent(this); } } //-------------------------------------------------------------------------- - namespace Urdbrichedit { void __fastcall PACKAGE Register() { TComponentClass classes[1] = {__classid(TURDBRichEdit)}; RegisterComponents("ERP.Tool", classes, 0); } } //-------------------------------------------------------------------------- - #ifndef URDBRichEditH #define URDBRichEditH //-------------------------------------------------------------------------- - #include <SysUtils.hpp> #include <Classes.hpp> #include <ComCtrls.hpp> #include <Controls.hpp> #include <DBCtrls.hpp> #include <StdCtrls.hpp> #include "URight.h" //-------------------------------------------------------------------------- - class PACKAGE TURDBRichEdit : public TDBRichEdit {private: protected: TURight*FURight; void __fastcall SetURight(TURight*Value); TMustNeedRight FMustNeedRight; bool FReadOnly; void __fastcall SetReadOnly(bool value); TColor FColorReadOnly,FColorEditable; public: __fastcall TURDBRichEdit(TComponent* Owner); __fastcall ~TURDBRichEdit(); bool AppendRight,EditRight,PrintRight,DeleteRight; __published: __property TURight*URight={read=FURight,write=SetURight}; __property TMustNeedRight MustNeedRight={read=FMustNeedRight,write=FMustNeedRight}; __property bool ReadOnly={read=FReadOnly, write=SetReadOnly}; __property TColor ColorReadOnly={read=FColorReadOnly, write=FColorReadOnly}; __property TColor ColorEditable={read=FColorEditable, write=FColorEditable}; }; //-------------------------------------------------------------------------- - #endif {smallsort} |