[SOLVED] Speciying OnMouse events when creating an array of TEdits lazarus / 62-General ---------------------------------------------------------------------- Hopestation · 2021-04-25 13:51 Hi I am using Lazarus #: 2.0.6+dfsg-3 with FPC Version: 3.0.4 In Linux. I want to specify the OnMouseDown event as I create an array of TEdit components. I have the procedure: procedure TFrmLbl.EdtMouseDown(Sender: TObject; Button: TMouseButton;                  Shift: TShiftState; X, Y: Integer); begin    EdtMv := True;    Source := TEdit(Sender);    TagNo := Source.tag; end; I have tried using:    Edt[NumBx].OnMouseDown := EdtMouseDown(Sender, Button, Shift, X, Y); and get the error messages that : Button, Shift X and Y don't exist. How do I assign this procedure to the OnMouseDown event at design time? Thanks ---------------------------------------------------------------------- lucamar · 2021-04-25 14:38 To assign an event handler at run-time, do it like this:Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i    Edt[NumBx].OnMouseDown := @EdtMouseDown; Since (I assume) you're creating the controls at run time you can't specify the handler at design-time (obviously). It would be otherwise if you were adding them at design-time; in that case all you would need would be to assign it in the object inspector, which you can do for several controls at a time by selecting them in the components tree (with Shift+ or Ctrl+Click) and specifying the handler in the "Events" tab. HTH! ---------------------------------------------------------------------- Hopestation · 2021-04-25 14:44 Thanks Lucamar, that's just what I was looking for.