I thought it was something simple to code, but the fact is that I'm finally facing issue about getting back checked/unchecked value of checkboxes and radiobuttons in a TNewCheckListBox.
I tried to set the checkboxes and radiobutton as global instance so that I can easily access it in the NextButtonClick event.
But in this sample test I get
Could not call proc.
[Code]
var
  PageChoixComposants: TWizardPage;
  CB1, CB2: TNewCheckBox;
  OB1, OB2: TNewRadioButton; 
procedure InitializeWizard;
var
  CheckListBox: TNewCheckListBox;
begin
  PageChoixComposants := CreateCustomPage(
    wpWelcome, 'Custom wizard page controls', 'TNewCheckListBox');
  CheckListBox := TNewCheckListBox.Create(PageChoixComposants);
  CheckListBox.Width := PageChoixComposants.SurfaceWidth;
  CheckListBox.Height := ScaleY(97);
  CheckListBox.Flat := True;
  CheckListBox.Parent := PageChoixComposants.Surface;
  CB1 := CheckListBox.AddCheckBox('CB1', '', 0, True, True, False, True, nil);
  OB1 := CheckListBox.AddRadioButton('CB1 OB1', '', 1, True, True, nil);
  OB2 := CheckListBox.AddRadioButton('CB1 OB2', '', 1, False, True, nil);
  CB2 := CheckListBox.AddCheckBox('CB2', '', 0, True, True, False, True, nil);
end;
//////////////////////////////////////////////////////////////////////
function NextButtonClick(CurPageID: Integer): Boolean;
begin
  if (CurPageID=PageChoixComposants.ID) then
    begin      
      if CB1.Checked = True then
        begin
          MsgBox('CB1 checked', mbInformation, MB_OK);
        end;
    end;
  Result := True;
end;
//////////////////////////////////////////////////////////////////////
What goes wrong here?
                        
The
AddCheckBoxandAddRadioButtonmethods returnInteger, notTNewCheckBox/TNewRadioButton.It's even surprising that your code compiles. It looks like some deficiency of a compiler.
The returned number represents an index of the checkbox/radio button. Use the index along with
TNewCheckListBox.Checked(or.State) property to query the checkbox/radio button state.A correct code is: