Is it possible to create checkbox tree view in Inn

2020-08-05 11:02发布

问题:

I have a plan to create new checkbox. But a checkbox is tree view. So, is it possible to create new checkbox tree view in Inno Setup?

Like checkbox tree view on this picture:

回答1:

Use the TNewCheckListBox class, just as the "task list" (WizardForm.TasksList):

var
  CheckListBox: TNewCheckListBox;

procedure InitializeWizard();
var
  CheckTreePage: TWizardPage;
begin
  CheckTreePage := CreateCustomPage(wpSelectTasks, 'My check list box page', '');
  CheckListBox := TNewCheckListBox.Create(WizardForm);
  CheckListBox.Parent := CheckTreePage.Surface;
  CheckListBox.Top := WizardForm.SelectTasksLabel.Top;
  CheckListBox.Width := WizardForm.TasksList.Width;
  CheckListBox.Left := WizardForm.TasksList.Left;
  CheckListBox.Height :=
    WizardForm.TasksList.Top + WizardForm.TasksList.Height - CheckListBox.Top;
  CheckListBox.WantTabs := True;
  CheckListBox.Color := clBtnFace;
  CheckListBox.BorderStyle := bsNone;
  CheckListBox.MinItemHeight := WizardForm.TasksList.MinItemHeight

  CheckListBox.AddCheckBox(
    'Additional software', '', 0, False, True, False, False, nil);
  CheckListBox.AddCheckBox(
    'Install\Update Microsoft DirectX', '', 1, False, True, False, True, nil);
  CheckListBox.AddCheckBox(
    'Install\Update Microsoft Visual C++', '', 1, False, True, False, True, nil);
  CheckListBox.AddCheckBox(
    'Install\Update NVIDIA PhysX', '', 1, False, True, False, True, nil);
end;