Board index » delphi » Changing an Inherited Form's base class

Changing an Inherited Form's base class

If I create a new form (inherited from TForm) then later decide to
change the base class of my new form to inherited from (TThisForm).
This seems to confuse the Delphi IDE at design-time b/c you don't see
the new inherited Form's (TThisForm) component's on the new form and
you seem to lose that nice IDE functionality for inherited forms such
as seeing the changes to the parent immediately take effect on the any
subclassed form.

How can I re-synchronize a parent and it's children for the Delphi
Design envirnoment?

Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.

 

Re:Changing an Inherited Form's base class


Quote
On Wed, 02 Jun 1999 15:10:03 GMT, randy.trex...@mail.va.gov wrote:
>If I create a new form (inherited from TForm) then later decide to
>change the base class of my new form to inherited from (TThisForm).
>This seems to confuse the Delphi IDE at design-time b/c you don't see
>the new inherited Form's (TThisForm) component's on the new form and
>you seem to lose that nice IDE functionality for inherited forms such
>as seeing the changes to the parent immediately take effect on the any
>subclassed form.

>How can I re-synchronize a parent and it's children for the Delphi
>Design envirnoment?

>Sent via Deja.com http://www.deja.com/
>Share what you know. Learn what you don't.

Try this :
1. You must add TThisForm to the project in question.  
2. Right click on form inherited from TForm and from the popup select
"View Form As Text".  
3. Change text (DFM as text) so that your form now inherits from
TThisForm.  Simply change the text "TForm" to "TThisForm".
4. Right Click on DFM as text and from the popup select "View as Form"
5. Click Ok to any Delphi prompt which might mention that it thinks
the ancestor of your form is wrong.  Delphi will fix it.
6. You should now see all the inherited aspects of TThisForm.

Grillix

Re:Changing an Inherited Form's base class


Thanks!! In the dfm file, I had to change the text "OBJECT" on the
first line to the word "INHERITED"

object Form5: TForm5  --> inherited Form5: TForm5
  Left = 305
  Top = 182
  Width = 783
.
.

then did what you said and select the option to "View as Form".  This
did exactly what I was expecting.  Thanks again!

In article <3756ee28.6086...@news.tcp.co.uk>,
  gril...@targa.com (grillix) wrote:

Quote
> On Wed, 02 Jun 1999 15:10:03 GMT, randy.trex...@mail.va.gov wrote:

> >If I create a new form (inherited from TForm) then later decide to
> >change the base class of my new form to inherited from (TThisForm).
> >This seems to confuse the Delphi IDE at design-time b/c you don't see
> >the new inherited Form's (TThisForm) component's on the new form and
> >you seem to lose that nice IDE functionality for inherited forms such
> >as seeing the changes to the parent immediately take effect on the
any
> >subclassed form.

> >How can I re-synchronize a parent and it's children for the Delphi
> >Design envirnoment?

> >Sent via Deja.com http://www.deja.com/
> >Share what you know. Learn what you don't.

> Try this :
> 1. You must add TThisForm to the project in question.
> 2. Right click on form inherited from TForm and from the popup select
> "View Form As Text".
> 3. Change text (DFM as text) so that your form now inherits from
> TThisForm.  Simply change the text "TForm" to "TThisForm".
> 4. Right Click on DFM as text and from the popup select "View as Form"
> 5. Click Ok to any Delphi prompt which might mention that it thinks
> the ancestor of your form is wrong.  Delphi will fix it.
> 6. You should now see all the inherited aspects of TThisForm.

> Grillix

Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.

Re:Changing an Inherited Form's base class


Im Artikel <7j3hg4$li...@nnrp1.deja.com>, randy.trex...@mail.va.gov schreibt:

Quote
>How can I re-synchronize a parent and it's children for the Delphi
>Design envirnoment?

A quite complete answer was already posted, so I'll only add a note:

I copied a standard VCL unit into a project, and then had problems to convince
D4 to use that copied unit, instead of the precompiled one. Object inspector
uses the properties as declared in the precompiled unit, but the (modified)
code executes, and also the added properties are accessible in code.

DoDi

Other Threads