Re: A compile problem or a conceptual one
From: Bruce Roberts (ber_at_bounceitattcanada.xnet)
Date: Thu, 27 Nov 2003 18:04:52 -0500
"Stark" <email@example.com> wrote in message
> I moved a proc from one module to another and I cannot compile it anymore.
> don't understand why. It fails with the message "Undefined identifier
> in the following statement:
> NewItem := TMenuItem.Create(Self);
> The unit where the proc used to be was a form with a TMenu as a component,
> while the unit where the proc was moved is a unit with no form (where I
> more general routines), so I suspect that the problem has something to do
> with this.
Read the ObjectPascal (Delphi) Language Reference. In particular note the
difference between a Procedure and a Method.
Self is only valid in methods.
Alter your procedure to take a parameter that replaces Self.