Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to use event in script? #271

Open
luizluvizutto opened this issue Sep 3, 2024 · 1 comment
Open

How to use event in script? #271

luizluvizutto opened this issue Sep 3, 2024 · 1 comment

Comments

@luizluvizutto
Copy link

procedure fechar(Sender: TObject; var CloseAction: TCloseAction);
begin
   Showmessage( 'Vou fechar' );
end;

procedure exec;
var F: TForm;
begin
   F :=  TForm.Create(NIL);
   try
      F.OnClose := @fechar;
      F.ShowModal;
   finally
      F.Free;
   end;
end;

I'm having trouble getting my code to pass the "Onclose" event of TForm and other classes as well.
The code above opens the form normally, but the event doesn't work and doesn't give an error.
I'm using Lazarus 3.4 and compiling in 64 bit.
What am I doing wrong?

@brunaoalberto
Copy link

I have the same problem, I can't use events.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants