🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Function pointer problem

#15
From: btm
Date: Tue, 14 Sep 1999 00:00
52 lines
2074 bytes
In a general form used by several other forms I defined a function
reference like this [Delphi 1]:

      type
        TCheckFunc = function (FldNr: integer): Boolean;
        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;
        end;

      implementation
      {$R *.DFM}

      procedure TForm1.Button1Click(Sender: TObject);
      var frm: TSetParam;
      begin
      frm:=TSetParam.create(self);
      frm.CheckStatus:=Form1Check;    { doesn't work! WHY? }
      frm.showmodal;
      frm.Release;
      end;


      function TForm1.Form1Check (FldNr: integer): Boolean;
      begin
      { set to True or False according to specific conditions : }
      result:=True;  
      end;


Alas, there is something wrong with this... The compiler says that the
assignment
      frm.CheckStatus:=MyCheck;
is an invalid function/procedure reference. What's wrong with this?



Thanks for any hints!

Thomas
Technical Details
Message-ID: <37de2a8b.335943@news.spectraweb.ch>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 1043cf,6601e79a50d8304,start
X-Google-Attributes: gid1043cf,public
X-Google-Thread: 109d99,6601e79a50d8304,start
X-Google-Attributes: gid109d99,public
From: btm@gmx.net (btm)
Subject: Function pointer problem
Date: 1999/09/14
Message-ID: <37de2a8b.335943@news.spectraweb.ch>
X-Deja-AN: 524891427
Content-Transfer-Encoding: 7bit
Content-Type: text/plain; charset=us-ascii
X-Complaints-To: usenet@sunrise.ch
X-Trace: news1.sunrise.ch 937306820 10594 194.230.8.193 (14 Sep 1999 11:00:20 GMT)
Organization: sunrise communications ag
Mime-Version: 1.0
Reply-To: NO-SPAMbtm@gmx.net
NNTP-Posting-Date: 14 Sep 1999 11:00:20 GMT
Newsgroups: comp.lang.pascal.delphi.components.misc,borland.public.delphi.objectpascal