OnClick procedure for Control Arrays. lazarus / 31-LCL ---------------------------------------------------------------------- Hopestation · 2010-10-08 09:49 Hello. In Delphi4 I can create an array of radio buttons and use a common OnClickRdBtn call. Here is my Delphi code:- uses ..     procedure RdBtnClick(Sender: TObject); .. implementation .. procedure TForm1.FormCreate(Sender: TObject); Var   N: Integer; begin   For N := 0 to 9 Do   begin     RdBtn[N] := TRadioButton.Create(Owner);     RdBtn[N].Parent := RadioGroup1;     RdBtn[N].OnClick := RadioButtonClick;   end; ..    procedure TForm1.RdBtnClick(Sender: TObject); Var   Source: TRadioButton;   N: Integer; begin   Source := TRadioButton(Sender);   N := Source.Tag;   Edit1.Text := IntToStr(N);; end; This works and operates on the selected button. When I import it into Lazarus it still works. When I try to create the form in Lazarus I get the message not enough paramerters, but nothing to tell me what parameters are required. Here is my Lazarus code:- uses ..     procedure RadioButtonClick(Sender: TObject); .. implementation .. procedure TForm1.FormCreate(Sender: TObject); Var   N: Integer; begin   For N := 0 to 9 Do   begin     RdBtn[N] := TRadioButton.Create(Owner);     RdBtn[N].Parent := RadioGroup1;     RdBtn[N].OnClick := RadioButtonClick;   end; end; .. procedure TForm1.RadioButtonClick(TRadioButton); Var   Source: TRadioButton; begin   Frm_Main_1.Edit3.Text := Copy(RadioButton9.Caption,1,1); end;  The following messages are displayed:- type1.pas(58,41) Error: Wrong number of parameters specified for call to "RadioButtonClick" type1.pas(18,15) Hint: Found declaration: TForm1.RadioButtonClick(TObject); type1.pas(62,47) Fatal: Syntax error, ":" expected but ")" found. What am I doing wrong? Thanks Roger. ---------------------------------------------------------------------- fabienwang · 2010-10-08 09:54 as you defined the method: procedure TForm1.RadioButtonClick(TRadioButton); you should add this in the type: procedure RadioButtonClick(TRadioButton); OR you can try procedure RadioButtonClick(TRadioButton); instead of TForm1. ---------------------------------------------------------------------- eny · 2010-10-08 10:02 Also, try this: Code: [Select]RdBtn[N].OnClick := @RdBtnClick; Note the @-symbol. ---------------------------------------------------------------------- Hopestation · 2010-10-09 13:08 Thank you both for your help. Using @ worked. I don't need this in Delphi4. Is there a simple explanation of why it is needed in Lazarus? Regards Roger ---------------------------------------------------------------------- felipemdc · 2010-10-09 13:17 Free Pascal support various Pascal dialects. If you want to use the Delphi dialect then you should use the {$mode delphi} directive in your source code.