Link to home
Start Free TrialLog in
Avatar of EricTaylor
EricTaylor

asked on

Passing procedure as parameter; Delphi 2012

In a Delphi 2010 library, I need to dynamically create a popupmenu (this part is fine), associate it with a control (also fine I think), and associate the created menu items with an OnClickEvent back in the calling program (this is the problem). I have a procedure that simplified is like this:
TMymenu.Create(aControl:TControl; onClickEvent:TProcedure;...)

Open in new window

This creates the menu and associates the procedure with the OnClick events for the created menu items. I try to call this with something like:
MyMenu.create(anEdit, EditOnClickEvent...);

Open in new window

(MyMenu is an instance of TMyMenu, and object I created with various stuff needed for the menu to work.) When I compile, I get "Incompatible types: 'regular procedure and method pointer'". Need guidance on passing the procedure. Need guidance on how to correctly pass the procedure. Thanks.
ASKER CERTIFIED SOLUTION
Avatar of MerijnB
MerijnB
Flag of Netherlands image

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
is your EditOnclick... procedure part of a main class? If not - should be.
Avatar of EricTaylor
EricTaylor

ASKER

Sinisa, the procedure is correctly defined as part of a main class.
Thanks