Skip to content

How to use event in script? #271

@luizluvizutto

Description

@luizluvizutto
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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions