Board index » cppbuilder » TFrame Base Class And IDE Problem

TFrame Base Class And IDE Problem


2005-06-28 01:48:18 AM
cppbuilder80
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
I needed to have a set of TFrames with a Refresh method so I took
a Frame I created (in the IDE) and extedned it from a base class
as follows:
class TMyFrameBase: public TFrame
{
__published: // IDE-managed Components
private: // User declarations
public: // User declarations
__fastcall TMyFrameBase(TComponent* Owner) : TFrame(Owner) {};
__fastcall ~TMyFrameBase() {};
virtual void Refresh(void) {};
};
I then change my frame class
// class TMyFrameClass : public TFrame
class TMyFrameClass : public TMyFrameBase
{
__published: // IDE-managed Components
TBitBtn *btnExit;
void __fastcall btnExitClick(TObject *Sender);
public: // User declarations
__fastcall TMyFrameClass (TComponent* Owner);
void Refresh(void);
}
//__fastcall TMyFrameClass ::TMyFrameClass (TComponent* Owner)
// : TFrame(Owner)
__fastcall TMyFrameClass ::TMyFrameClass (TComponent* Owner)
: TMyFrameBase(Owner)
{
/* Do some init stuff */
}
void __fastcall TMyFrameClass ::btnExitClick(TObject *Sender)
{
This->Hide();
}
void TMyFrameClass::Refresh(void)
{
/* Do some refresh stuff */
}
Now, this compiles fine and executes without a hitch. The problem comes
when I try to go in and edit the Frame using the IDE. I open the
project (I'm using BCB Update Pack 1 on Windows XP SP2) and the IDE
starts spitting out errors about properties and so on. It then FINALLY
(after chosing to Ignore the errors) comes up and I can edit the Frame
in the form designer but when I try to save it will throw up an error:
Error in module MyFrameClass: Declaration of class TMyFrameClass is
missing or incorrect.
Is there any way around this? I'm creating a whole series of different
Frame objects, but each needs to have a Refresh() member so I figured
it would be best to derive from a base class that had a virtual
Refresh() function. And while it works (in terms of compiling) it is
just not feasible to go into the code, change every instance of
TMyFrameBase to TFrame (and adjust all other code appropriately) in
order to change the Frame anytime I need to go back in. Plus all the
work associated with putting it back.
Is there an easy way to do this? I've tried conditional compilation
(i.e.: #ifndef DESIGNTIME) but it doesn't work.
Any help or pointers would be greatly appreciated.
Drew.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.5 (MingW32)
Comment: Using GnuPG with Thunderbird - enigmail.mozdev.org
iD8DBQFCwDvi+cCIvS8c+5MRAt22AJ9NinkjyNKC3pZp9JsyDPXu8973qwCgkOGh
iJiGddwW1fOH4Oa1Z3j2uv8=
=0ANF
-----END PGP SIGNATURE-----
 
 

Re:TFrame Base Class And IDE Problem

Hi,
Quote
class TMyFrameClass : public TMyFrameBase
Error in module MyFrameClass: Declaration of class TMyFrameClass is
I have not done what you are trying but I know when deriving
from some things, e.g. TDataModule it is important to use
the PACKAGE class modifier, e.g.
class PACKAGE TDataModule1 : public TDataModule
{
--Craig