🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.pascal.delphi.components.misc
Article #17

Re: Function pointer problem

#17
From: Bruce Roberts
Date: Tue, 14 Sep 1999 00:00
48 lines
2108 bytes
btm <btm@gmx.net> wrote in message
news:37de2a8b.335943@news.spectraweb.ch...
> In a general form used by several other forms I defined a function
> reference like this [Delphi 1]:
>
>       type
>         TCheckFunc = function (FldNr: integer): Boolean;

This declares a function type that is declared at the main level of a unit,
not a class method.

>         TSetParam = class(TForm)
>           ....
>         public
>           CheckStatus: TCheckFunc;
>         end;
>
> In several of my forms I now want to do something like this:
>
>       type
>         TForm1 = class(TForm)
>           Button1: TButton;
>           procedure Button1Click(Sender: TObject);
>         private
>         public
>           function Form1Check (FldNr: integer): Boolean;

This is a class function.

>         end;
>

You can either change your type definition to

         TCheckFunc = function (FldNr: integer): Boolean of object;

or remove Form1Check from the form declaration and place it in the main body
of the unit, e.g.

type
    form1 = . . .
        end;

    function Form1Check . . .

Either will correct the error. However in this case you probably want to
change the function type definition (the first suggestion).
Technical Details
Message-ID: <yCsD3.874$2s.152@cabot.ops.attcanada.net>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <37de2a8b.335943@news.spectraweb.ch>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 109d99,6601e79a50d8304
X-Google-Attributes: gid109d99,public
X-Google-Thread: 1043cf,6601e79a50d8304
X-Google-Attributes: gid1043cf,public
From: "Bruce Roberts" <no.junk.please.ber@attcanada.net>
Subject: Re: Function pointer problem
Date: 1999/09/14
Message-ID: <yCsD3.874$2s.152@cabot.ops.attcanada.net>
X-Deja-AN: 524986572
References: <37de2a8b.335943@news.spectraweb.ch>
X-Priority: 3
X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2314.1300
X-Trace: cabot.ops.attcanada.net 937317918 142.194.174.154 (Tue, 14 Sep 1999 14:05:18 GMT)
X-MSMail-Priority: Normal
Reply-To: "Bruce Roberts" <no.junk.please.ber@attcanada.net>
NNTP-Posting-Date: Tue, 14 Sep 1999 14:05:18 GMT
Newsgroups: comp.lang.pascal.delphi.components.misc,borland.public.delphi.objectpascal