Board index » cppbuilder » TFrame problem

TFrame problem


2004-02-03 11:44:17 PM
cppbuilder113
Hi all,
I'm currently doing a test to see how TFrame works ..
I wanted to derive different TFrame to contains subsets of control .. (group of TEdit, etc ... etc..)
It works ..
The problem is when I try to create two or more TFrame on the same TPanel (at runtime) ..
Like this :
__fastcall TFormMain::TFormMain(TComponent* Owner)
: TForm(Owner)
{
// test
TFrameNumber *pF = new TFrameNumber(this);
pF->Parent = GlobalPanel;
TFrameNumber *pF2 = new TFrameNumber(this);
pF2->Parent = GlobalPanel;
}
GlobalPanel is a TPanel on the TFormMain ...
I receive an exception : EComponentError with message 'A component named FrameNumber already exists'. ...
Anyone have an idea ?
Thanks,
Didier (.be)
 
 

Re:TFrame problem

A guess:
Change the name of each Frame before changing the parent.
HTH Pete
Quote
"Didier" < XXXX@XXXXX.COM >wrote:
>
>Hi all,
<snipppp>
Quote
>GlobalPanel is a TPanel on the TFormMain ...
>
>I receive an exception : EComponentError with message 'A component named
FrameNumber already exists'. ...
 

Re:TFrame problem

Although you used a different pointer, the Name property is probably the
same. After you create pF2, change the 'Name' parameter, (to
FrameNumber2 for example), then assign the Parent, and see if that works.
David Erbas-White
Didier wrote:
Quote
Hi all,

I'm currently doing a test to see how TFrame works ..

I wanted to derive different TFrame to contains subsets of control .. (group of TEdit, etc ... etc..)
It works ..

The problem is when I try to create two or more TFrame on the same TPanel (at runtime) ..

Like this :

__fastcall TFormMain::TFormMain(TComponent* Owner)
: TForm(Owner)
{
// test
TFrameNumber *pF = new TFrameNumber(this);
pF->Parent = GlobalPanel;

TFrameNumber *pF2 = new TFrameNumber(this);
pF2->Parent = GlobalPanel;
}

GlobalPanel is a TPanel on the TFormMain ...

I receive an exception : EComponentError with message 'A component named FrameNumber already exists'. ...


Anyone have an idea ?

Thanks,

Didier (.be)
 

{smallsort}