How do I debug or fix the "Module has open children or related modules" error?

I had this long-standing problem that I cannot treat as a text, main form for a project that I inherited. Even if no other forms are open.

How can I debug the cause of this error message? What options should I fix?

I found one related newsgroup http://embarcadero.newsgroups.archived.at/public.delphi.ide/200906/0906193960.html but this only deals with the reason for form inheritance and doesn't say anything about related modules, I don't believe that I use form inheritance.

I have a DM (data module) for a project and the form loads a couple of images from the dm via TTreeView properties on the form - does the data module automatically mean I can never see as form text in Delphi (other than view the form as text in notepad)? It doesn't look like my DM is open or closed in the IDE.

I also found one SO question with a related title ( Module% s has open descendants or related modules. Cannot be reloaded ), but the question and answer itself is not particularly relevant.

+3


source to share


1 answer


This is sometimes caused by a form that inherits from another form in your project (or gallery) (known as visual form inheritance in the documentation, IIRC). The IDE doesn't know how to find the base class for the form; it must be open before the child form. For example, this can lead to the same error if the block containing TMyBaseForm

is not first opened in the IDE, especially if the base (ancestor) module is not included first in the project:

unit SpecialForm;

interface

uses
  Forms, { all the other usual stuff }, BaseForm;

type
  TMySpecialForm = class(TMyBaseForm)
  private

  public

  end;

      



You can tell if this is the case by looking at the form's class declaration - if it comes from anything other than TForm

, this is probably the cause of the error.

(Another case where this happens is often used when using datamodule because the TDataModule

.DFM base is not available. Trying to view datamodule.DFM as text throws this error every time, the solution is to close your project and use an external editor like Notepad or "Notepad ++" to edit the .dfm for your datasheet.)

+1


source







All Articles