Forum > General
type TPutItemIDEvent = procedure (Sender: TObject; ItemID: integer; Code: string
(1/1)
Rieske1969:
Hello there,
I am new to Lazerus but done some great development with Delphi a few years ago.
What I'm trying to do is create a simular type of application as I did with Delphi 7 but I'm running in to some problems.
There a two form, Main.pas and Settings.pas.
Settings.pas is called via a Button on Main.pas and I want to give a notification back from Settings.pas to Main.pas.
In Delphi I did it as follows:
Main.pas
-------------------------
private
procedure PutItemSearchEvent(Sender: TObject; ItemID: integer; Code: string);
procedure TfrMain.PutItemSearchEvent(Sender: TObject; ItemID: integer; Code: string);
begin
end;
Settings.pas
--------------------------
type TPutItemIDEvent = procedure (Sender: TObject; ItemID: integer; Code: string) of object;
private
{ private declarations }
fOnPutItemIDEvent : TPutItemIDEvent;
public
{ public declarations }
property OnPutItemIDEvent: TPutItemIDEvent read fOnPutItemIDEvent write fOnPutItemIDEvent;
When I call the settings form there is an event that is instanced to a local procedure.
frSettings := TfrSettings.Create(self);
frSettings.OnPutItemIDEvent:= PutItemSearchEvent;
frSettings.Visible := false;
frSettings.ShowModal;
frSettings := nil;
In Settings.pas I can give the parameters: Sender, ItemID and Code back to Main.pas.
In Delphi this worked but in Lazerus I get the following error: 'main.pas(56,33) Error: Wrong number of parameters specified for call to "PutItemSearchEvent"'
What am I doing wrong?
Richard
howardpc:
You probably have {$mode objfpc}
So you have to explicitly use the @ operator:
--- Code: Pascal [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} --- frSettings.OnPutItemIDEvent:=@PutItemSearchEvent;
or use {$mode delphi}
Rieske1969:
Wow, that was quick (and painless)
Thanks.
Navigation
[0] Message Index