Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Delphi: How to get rid of "Ancestor of TMyForm not found error'?

Tags:

ide

delphi

I have some forms inherited from a TMyForm (TMyForm is a 3rdparty component with source code form).

When I open in the IDE my forms inherited from TMyForm I have:

Error creating form: Ancestor for 'TMyForm ' not found.

The workaround is to open the TMyForm unit in the IDE and then try top open my inherited forms.

But how can I avoid that Delphi gives this error and is able to open my forms even if TMyForm is not opened in the IDE?

like image 848
LaBracca Avatar asked Dec 23 '10 11:12

LaBracca


2 Answers

You need to have the parent form opened in the IDE or added to the project, there's no workaround, unfortunately. Over here: Register custom form so I can inherit from it from multiple projects, without copying the form to the Object Repository folder I attempted lots and lots of things, without success.

like image 62
Cosmin Prund Avatar answered Sep 19 '22 09:09

Cosmin Prund


My Workaround. There are several ways:

  • Add to project full path to all of the parent form. Uncomfortable, because of absolute path
  • Add package with parent forms to the project list. In this case, no problems there. But every time it is necessary to open a components in the delphi environment.
  • Use a temporary solution from embarcadero.

There is automatically opens all the child forms:

Ticket, was created about 10 years ago: http://qc.embarcadero.com/wc/qcmain.aspx?d=8376

Here you can download the version for Delphi XE2: https://bitbucket.org/hemn/autoopenunit

I recommend it!

like image 36
hemn Avatar answered Sep 22 '22 09:09

hemn