Re: A compile problem or a conceptual one

From: Stark (starkwedder_at_virgilio.it)
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
news:0wvxb.1063$j94.21799@news20.bellglobal.com...
>
> "Stark" <starkwedder@virgilio.it> wrote in message
> news:Uyuxb.17736$AX1.690847@news1.tin.it...
> > I moved a proc from one module to another and I cannot compile it
anymore.
> 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
component,
> > 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
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.
>
>