Re: A compile problem or a conceptual one

From: Stark (
Date: 11/30/03

Date: Sun, 30 Nov 2003 18:40:48 GMT

But the statement in question was and still is within a procedure. I
thought "Self" meant the TMenu object. How can I replace it ?
(You are certainly right. I don't understand the difference between a
procedure and a method ...)

"Bruce Roberts" <ber@bounceitattcanada.xnet> ha scritto nel messaggio
> "Stark" <> wrote in message
> news:Uyuxb.17736$
> > I moved a proc from one module to another and I cannot compile it
> I
> > don't understand why. It fails with the message "Undefined identifier
> Self"
> > in the following statement:
> > NewItem := TMenuItem.Create(Self);
> > The unit where the proc used to be was a form with a TMenu as a
> > while the unit where the proc was moved is a unit with no form (where I
> keep
> > more general routines), so I suspect that the problem has something to
> > 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.