views:

96

answers:

1

Hi,

I am improving a Delphi program... There is a procedure that expects a TFormClass argument (class of TForm).

I passed in TForm1 or like and it did not like. E.g. procname(TForm1); There are other forms in the program that are passed in similarly in the program, yet there is no such compilation errors for them.

E.g. there is another form that is passed and it is defined as

type TForm4 = class(TForm)
....
procname(TForm4);

This does not cause a compilation error.

My form is defined as type

  TForm1 = class(TForm)...

It looks similar, right? What may be the reason this is not accepted by the compiler?

Why are the others accepted ? What may be the difference?

Thank you.

A: 

First of all, I did not write this program. I improved it.. The program had a unit which was imported in all units where the problem did not come up.

let it be called "UnitWithAdditionalTFormDotDefinitions".

The solution was easy.

at the beginning of the unit n the this error message originated, I changed the uses statement.

E,g.

uses Unit1,Unit2,Forms; // this was the original state or similar

After

uses Unit1,Unit2,Forms,UnitWithAdditionalTFormDot;

Aftershock