Book a Demo

Author Topic: C++ code outside curling braces  (Read 3736 times)

kalbun

  • EA Novice
  • *
  • Posts: 6
  • Karma: +0/-0
  • I love YaBB 1G - SP1!
    • View Profile
C++ code outside curling braces
« on: December 23, 2004, 02:09:55 pm »
Suppose I have a class like this:

class TAmbient : public TTabSheet
{...}

If TTabSheet constructor has no parameters, then I don't need to define TAmbient constructor because:

TAmbient* Ambient = new TAmbient

is OK (the compiler automagically generates the ancestor's constructor).

But suppose TTabSheet constructor requires a parameter : in this case I need to write an explicit constructor, which source code is something like:

__fastcall TAmbient::TAmbient(TComponent* AOwner)
: TTabSheet(AOwner)
{
...
}

Now the question : how to do it with EA? If I write code outside the curling braces, it is deleted each time the source code is generated!!

ok, enough for now...

Happy X-Mas and Peace to everyone!!

:)

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8110
  • Karma: +119/-20
    • View Profile
Re: C++ code outside curling braces
« Reply #1 on: December 23, 2004, 02:23:52 pm »
What you need to do is create a tagged value on your constructor called "initializer".  In the value put TTabSheet(AOwner).

Alternatively put <memo> in the value field so that you can put a much larger amount of initialization data in.

Merry Christmas to you too.

Simon