Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to make an old form inherit from another?

I have an existing form and i want this form now, to inherit from another form.

For a new form i know how to do this, just go on File > New > Other > Inheritable items and select the father form. But what about an already existent form ?

Here is what i tried, change this :

type
  TFrmMyForm = class(TForm)

To this :

type
  TFrmMyForm = class(TFrmFatherForm)

But it doesn't seem to work, as FrmMyForm isn't importing FrmFatherForm components.

Is there a way to achieve this ?

Thanks

like image 278
delphirules Avatar asked Oct 29 '25 16:10

delphirules


1 Answers

Open dfm file in some other text editor and replace object with inherited

object FrmMyForm : TFrmMyForm

to

inherited FrmMyForm : TFrmMyForm

However, Delphi has issues with opening such forms if they don't belong to the same project. For instance, if you have base form declared in a package and you are using it to inherit forms in application or another package.

If you have problem opening such forms, make sure that you first open base form and then inherited.

like image 52
Dalija Prasnikar Avatar answered Oct 31 '25 07:10

Dalija Prasnikar



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!