Re: A compile problem or a conceptual one
From: Stark (starkwedder_at_virgilio.it)
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" <firstname.lastname@example.org> ha scritto nel messaggio
> "Stark" <email@example.com> wrote in message
> > I moved a proc from one module to another and I cannot compile it
> > 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
> > 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
> > 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.