2

I have seen answers for capturing events from user-created controls on wizard pages, but how do you do it for controls created as a result of a call to CreateInputOptionPage?

For example:

InputOptionPage := CreateInputOptionPage (wpWelcome,
  'Options', 
  'Select your option',
  'Please choose from one of the three options below:'
  True, False);

InputOptionPage.Add ('Option 1') ;
InputOptionPage.Add ('Option 2') ;
InputOptionPage.Add ('Option 3') ;

will create an option page with a radio group on it. I don't intend selecting any of the options by default and want to force the user to do so. As a visual clue I want to gray out the "Next" button while none are selected.

How do I add an OnClick handler for the radio buttons?

rossmcm
  • 5,493
  • 10
  • 55
  • 118

2 Answers2

2

Short extract from Robert Love's answer:

procedure YourControlClick(Sender: TObject);
begin
  MsgBox('yep', mbError, 0);
end;

YourControl.OnClick := @YourControlClick;

I.e. everything is similar to usual Delphi style except for @ symbol. Omitting it results in confusing "Invalid number of parameters" error during compile.

Fr0sT
  • 2,959
  • 2
  • 25
  • 18
2

Although not directly the same question, the answer I just provided to this question shows how to do this for a Check Box but it's identical for a radio box.

Community
  • 1
  • 1
Robert Love
  • 12,447
  • 2
  • 48
  • 80