Board index » cppbuilder » TFrame compiler error

TFrame compiler error


2004-08-09 06:16:13 PM
cppbuilder12
Hi everyone.
I use a TFrame but when i try to compile my application this message occur:
"E2015 Ambiguity between TFrame and Forms::TFrame".
Any ideas?
Thanks in advanced.
Marco.
 
 

Re:TFrame compiler error

Can you show some code on which compiler stopped?
Best regards,
Vladimir Stefanovic
Quote
I use a TFrame but when i try to compile my application this message
occur:
"E2015 Ambiguity between TFrame and Forms::TFrame".
Any ideas?

Thanks in advanced.
Marco.

 

Re:TFrame compiler error

"Vladimir Stefanovic" < XXXX@XXXXX.COM >wrote:
Quote
Can you show some code on which compiler stopped?
This is header file code, the compiler stopped on the first
brace bracket (after "class TFrameOUT : public TFrame"):
#ifndef FrmFrameOutH
#define FrmFrameOutH
//------------------------------------------------------
#include <Classes.hpp>
#include <Controls.hpp>
#include <StdCtrls.hpp>
#include <Forms.hpp>
//-----------------------------------------------------
class TFrameOUT : public TFrame
{
__published: // IDE-managed Components
TLabel *LblIN1;
TLabel *LblIN2;
TLabel *LblIN3;
TLabel *LblIN4;
TLabel *LblIN5;
TLabel *LblIN6;
private: // User declarations
public: // User declarations
__fastcall TFrameOUT(TComponent* Owner);
};
//------------------------------------------------------
extern PACKAGE TFrameOUT *FrameOUT;
//----------------------------------------------------
#endif
Sorry for my bad english.
Thank you very much.
Marco
 

{smallsort}

Re:TFrame compiler error

Some news....
The compiler error occurs when i use the frame on a form.
Any idea.
Thanks.
Marco
 

Re:TFrame compiler error

Let's go step by step:
1) Start BCB / File / New Application (if it isn't created
automatically on startup)
2) BCB / File / New Frame (It's name by default is Frame2 in
Unit2.cpp/h)
3) Drop TMemo (Memo1) on Frame2, just for example, and set
Align property to alClient. Set also property Align to alClient of
TFrame2.
4) Go to Project / Options / Forms and note that Frame2 is in
section AVAILABLE FORMS (not in auto-create forms!), which
means that the Frame2 instance must be created at run-time:
5) Add code in Form1's OnActivate() event:
void __fastcall TForm1::FormActivate(TObject *Sender)
{
Frame2 = new TFrame2(this);
Frame2->Parent = this; // <----- NOTE THIS, IT'S CRUCIAL
}
6) BCB / File / Include unit header: Unit2
7) Destruction (it's better to make standard C++ style destructor)
void __fastcall TForm1::FormDestroy(TObject *Sender)
{
delete Frame2;
}
8) Start the application...
If it works than compare you concept to this concept.
Best regards,
Vladimir Stefanovic
 

Re:TFrame compiler error

I've never used TFrame and so i follow Borland C++ help:
--------------------------------------------------------------
The Form Designer provides two ways to add a frame to an
application:
Select a frame from the Component palette and drop it onto
a form, another frame, or another container object.
If necessary, the Form Designer asks for permission
to include the frames unit file in your project.
--------------------------------------------------------------
In this way it doesn't work.
I try to use your suggestion Vladimir.
Thank you very much.
Marco