Forum > Other

Tmenuitem and Tpopupmenu question

(1/1)

BOSHU:
Hi!
in a tpaintbox descendant i have a procedure declared
PROCEDURE NEWLAGDB(SENDER:TOBJECT);


In the constructor i have the following lines
........
FLAGDBPM:=TPOPUPMENU.Create(SELF);
TM:=TMENUITEM.Create(SELF);TM.Caption:='New';
TM.OnClick:=NEWLAGDB;
FLAGDBPM.Items.Add(TM);
........

I get an error when trying to assign a procedure to the onclick event.
Compiler writes : Wrong number of parameters specified
The component i'm trying to compile using Lazarus (for linux) was ported from Delphi 6.
How do i assign a procedure to the onclick event?
 :roll:
Bye!

Anonymous:
And the solution :)

........
FLAGDBPM:=TPOPUPMENU.Create(SELF);
TM:=TMENUITEM.Create(SELF);TM.Caption:='New';
TM.OnClick:=@NEWLAGDB;
FLAGDBPM.Items.Add(TM);
........

And before compilin' it be sure you save the files.

Navigation

[0] Message Index

Go to full version