Board index » cppbuilder » Need Help: Runtime Instantiating of VCL Components

Need Help: Runtime Instantiating of VCL Components

Hi.

I need help to understand how I can properly instantiate VCL components at
Runtime.
Lets say I dont know how many TQuery components I need.

So somewhere in my app. I try this:
TQuery *Q1 = new TQuery(Form1);

But this gives an unresolved external !?
Why is that, am I missing an include file somewhere or what ?

Thanks for any help
Regards Thue Tuxen

 

Re:Need Help: Runtime Instantiating of VCL Components


Make sure you include the dbtables.hpp header

Gambit

"Thue Tuxen S?rensen" <tu...@esynergy.dk> wrote in message
news:3bf1ac71_1@dnews...

Quote
> So somewhere in my app. I try this:
> TQuery *Q1 = new TQuery(Form1);

> But this gives an unresolved external !?
> Why is that, am I missing an include file somewhere or what ?

Re:Need Help: Runtime Instantiating of VCL Components


Thanks, it worked.
I thought it figured every reference out from VCL.h

So you just have to know the right header file.
Well one can spy on what happens in the header file of TForm when you drop
the desired component ...

Thue

Remy Lebeau <gambi...@gte.net> skrev i en
nyhedsmeddelelse:3bf1b0f7_2@dnews...

Quote
> Make sure you include the dbtables.hpp header

> Gambit

> "Thue Tuxen S?rensen" <tu...@esynergy.dk> wrote in message
> news:3bf1ac71_1@dnews...

> > So somewhere in my app. I try this:
> > TQuery *Q1 = new TQuery(Form1);

> > But this gives an unresolved external !?
> > Why is that, am I missing an include file somewhere or what ?

Re:Need Help: Runtime Instantiating of VCL Components


"Thue Tuxen S?rensen" <tu...@esynergy.dk> wrote in message
news:3bf1b488_2@dnews...

Quote
> Thanks, it worked.
> I thought it figured every reference out from VCL.h

Not all, only the more common ones you're most likely to use.  Anything
extra, like database functionality, needs explicit header includes.

Quote
> So you just have to know the right header file.
> Well one can spy on what happens in the header file of TForm when you drop
> the desired component ...

No need, just look in the help file, it tells you exactly which one to
include.  In your case, when you look up TQuery, one of the first thngs it
says is "Unit dbtables" which tells you to include the dbtables.hpp header.

Gambit

Other Threads