Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Error creating form: Ancestor for '<ParentForm>' not found

Status
Not open for further replies.

geomagas

Programmer
Nov 4, 2009
3
GR
Hi all,

First off, I use Delphi 6 upd pack 2 on WinXP.

I've been programming in Delphi for over a decade now. Up until recently, I used to include everything the project needed in the project source. One day I decided to make my own library(ies) for obvious reasons.

I started by making a TfrmMDIAppMain = class(TForm), a common ancestor for all my MDI apps' mainforms. I added its location at the Library Path in Tools->Env.Options->Library.

As a second step, I created a test project with TfrmMDIAppDescMain = class(TfrmMDIAppMain) as its main form. The project compiled ok, even though TfrmMDIAppMain's unit was not included in the project. But the next time I opened the project and doubleclicked on TfrmMDIAppDescMain, I got "Error creating form: Ancestor for 'TfrmMDIAppDescMain' not found". The source file is opened but the form cannot be displayed.

Now, if I open TfrmMDIAppMain in the editor (which by the way works by right-clicking it in the editor and selecting Find Declaration) and reopen its descendant, everything is fine and the form displays correctly.

After adding the parent's path to every possible (environment and project) path I came to the conclusion that, in order for the error not to appear, one has to either add the parent form in the project or have the parent form opened before the descendant.

Is there any way to solve this? I mean, what's the use of a library path / project search path if the IDE can't utilize it?

Thanx
 
Did you add the unit containing your new form to the project source file?
 
Yes I did. I didn't add its parent, though. That's what I am trying to avoid...
 
you must inherit from TCustomForm

/Daddy

-----------------------------------------------------
What You See Is What You Get
Never underestimate tha powah of tha google!
 
You mean TfrmMDIAppMain = class(TCustomForm) or TfrmMDIAppDescMain = class(TCustomForm)?
Because, the second would be wrong, it would cancel the whole idea. And the first is kinda irrelevant, since TfrmMDIAppDescMain is the form that "is not found" (the ancestor of TfrmMDIAppMain).

Besides, as I already noted, it works as expected (compiles, runs and all). The problem is in the editior, when I try to open TfrmMDIAppMain.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top