Hi,
I have a normal TForm derived class (normal Builder stuff... a dfm, cpp and h files) that contains a TPanel suitably named 'Panel' and within its constructor I have the following lines of code:
mem being a private class variable of type TMemo*. This works without any problems. Next I have a purpose made class derived from TPanel, called from previous said class passing the form (this) as the owner to the TPanel and within its contructor the lines:
Here, however, on the line mem->Lines->Strings[]... I get the error: ...EInvalidOperation with message 'Control '' has no Parent window'... and I just cannot work out why. If anyone can summerise an answer or indicate a link to a previous post with a similar problem, I would be most appreciative.
Thanks in advance,
David.
I have a normal TForm derived class (normal Builder stuff... a dfm, cpp and h files) that contains a TPanel suitably named 'Panel' and within its constructor I have the following lines of code:
Code:
mem =new TMemo(Panel);
mem->Parent=Panel;
mem->Lines->Strings[0]="testing";
mem being a private class variable of type TMemo*. This works without any problems. Next I have a purpose made class derived from TPanel, called from previous said class passing the form (this) as the owner to the TPanel and within its contructor the lines:
Code:
MyClass::MyClass(TComponent* owner): TPanel(owner)
{
TMemo* mem =new TMemo((TPanel*) this);
mem->Parent=(TPanel*) this;
mem->Lines->Strings[0]="testing";
delete mem;
...
}
Here, however, on the line mem->Lines->Strings[]... I get the error: ...EInvalidOperation with message 'Control '' has no Parent window'... and I just cannot work out why. If anyone can summerise an answer or indicate a link to a previous post with a similar problem, I would be most appreciative.
Thanks in advance,
David.