Link to home
Start Free TrialLog in
Avatar of Paer Toernell
Paer ToernellFlag for Thailand

asked on

Delphi, Pointers to procedures

This code works :


     bde_name.OnKeyDown:=bde_nameKeyDown;

But when i Try to do the same thing with a pointer it fails:

procedure Tfrm_Jobbsiter.Button3Click(Sender: TObject);
    var
      p : TProcedure;
begin

     p:=bde_nameKeyDown;
     bde_name.OnKeyDown:=p;
end;

How is this done correctly?
Avatar of Superdave
Superdave
Flag of United States of America image

p should be declared "procedure of object" instead of TProcedure
Avatar of Paer Toernell

ASKER

Theax, but then i get "E2009 Incompatible types: 'Parameter lists differ"
-
In the working example i dont have to handle the parameters, and that is the point :P
SOLUTION
Avatar of jimyX
jimyX

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Very nice, but I guess the TKeyDown is not implemented in my old rad studio 2007.
Avatar of jimyX
jimyX

@ cyberkiwi,

Where did you come with that TKeyDown from? I do not think that's in Delphi at all.

If it's there what is the ideal use of it?
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial