Paer Toernell
asked on
Delphi, Pointers to procedures
This code works :
bde_name.OnKeyDown:=bde_na meKeyDown;
But when i Try to do the same thing with a pointer it fails:
procedure Tfrm_Jobbsiter.Button3Clic k(Sender: TObject);
var
p : TProcedure;
begin
p:=bde_nameKeyDown;
bde_name.OnKeyDown:=p;
end;
How is this done correctly?
bde_name.OnKeyDown:=bde_na
But when i Try to do the same thing with a pointer it fails:
procedure Tfrm_Jobbsiter.Button3Clic
var
p : TProcedure;
begin
p:=bde_nameKeyDown;
bde_name.OnKeyDown:=p;
end;
How is this done correctly?
p should be declared "procedure of object" instead of TProcedure
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
-
In the working example i dont have to handle the parameters, and that is the point :P
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Very nice, but I guess the TKeyDown is not implemented in my old rad studio 2007.
@ 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?
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
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.