16
votes

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?

4

4 Answers

15
votes

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.

3
votes

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!

1
votes

I've been searching all over for a solution to this and it seems I've finally found one.

I'm using a package with several base forms and frames.

I've added these to the repository, yet still the error came up.

Some of the forms and frames didn't show a 'dfm' in the Project Manager, it seems key to this, is to edit the .dpr file and add the name in curly brackets:

fIBSConnectionForm in 'GUI\BaseGUI\fIBSConnectionFrom.pas',

into

fIBSConnectionForm in 'GUI\BaseGUI\fIBSConnectionFrom.pas' {frmIBSConnectionForm},

and for frames, make sure to use {f...: TFrame}

After doing this and restarting Delphi, I could open descendant forms again!