Board index » cppbuilder » Changing inhertance later; (BCB6)

Changing inhertance later; (BCB6)


2003-09-03 08:55:32 PM
cppbuilder114
When designing a new Form I always use the 'Inherit' type in the 'Object
Repository'. This is nice, allowing me to have some general functionality in
the base forms/classes.
However, from time to time, I discover that an existing form in my project
really need to change it's base class.
This means changing the base form/class for an already existing form (ie
changing the '#pragma link "baseformname"' sentence).
Can I do this in any way?
Frank.
 
 

Re:Changing inhertance later; (BCB6)

"Frank Eid" < XXXX@XXXXX.COM >wrote in message
Quote
Can I do this in any way?
First, change what the form inherits from. If your form is already
inheriting from a class other than TForm then there is nothing else you'll
need to do. When you save the unit the appropriate #pragma and #include
lines will be added. You are free to remove the old #pragma and #include
lines.
If the form inherits from TForm then the next step is to edit the DFM "as
text" and change the first word that you see from "object" to "inherited".
Obviously, if you are changing the inherited class from a custom class back
to TForm then you will perform the text replacement in the opposite
direction.
Next, save everything, close down the project, and reopen it. Since you are
performing tasks that Builder might not have expected you to do it is better
to avoid a potential AV and project corruption.
HTH,
- Clayton