In delphi they can do this at runtime, create components and assign its events like
button1 := TButton.Create(nil);
//assign the caption
button1.Caption := 'Button1';
button1.Height := 45;
button1.Width := 55;
button1.Left := Form1.Width - button1.Width);
button1.Top := Form1.Height - button1.Height);
//if no parent is set, button will not be visible
button1.Parent := Form1;
//assign the OnClick event handler
button1.OnClick := Button1Click;
While in lazarus this is not possible, it generates a compiler's error of
Error: Wrong number of parameters specified for call to "BitBtn1Click"
Is there a way that we can create components and assign events during runtime in Lazarus?
Thanks.