Platform: Lazarus 1.8.1, FPC 3.0.5
I'm using a radio group component to both display info and to allow the user to select a choice. This means that the OnSelectionchange needs to be shut off while I set it to the current value, then, turn it on again for the user to make a selection. I'm trying to do this by setting the .OnSelectionChanged event to nil in the FormCreate procedure, and then in the FormShow procedure, reassign it. Like this:
procedure TForm2.RadioGroup1SelectionChanged(Sender: TObject);
begin
ShowMessage('My Selection has Changed');
end;
procedure TForm2.FormCreate(Sender: TObject);
begin
RadioGroup1.OnSelectionChanged := nil;
end;
procedure TForm2.FormShow(Sender: TObject);
begin
RadioGroup1.OnSelectionChanged := RadioGroup1SelectionChanged;
end;
The line RadioGroup1.OnSelectionChanged := RadioGroup1SelectionChanged; in the FormShow will not compile. The error message is:
Compile Project, Target: unable_to_assign_prc.exe: Exit code 1, Errors: 2
unit2.pas(47,37) Error: Wrong number of parameters specified for call to "RadioGroup1SelectionChanged"
unit2.pas(35,18) Error: Found declaration: RadioGroup1SelectionChanged(TObject);
What am I doing wrong. I'm tired and must be missing the obvious. Thanks in advance for your help.
I have attached a demo project (missed it on my first post)