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.