Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to split tasklist at tasks page of Inno Setup into multiple columns?

Tags:

inno-setup

Is it possible splitting tasklist at Select Additional Tasks page like in the picture below?

Example:

enter image description here

Thanks.

like image 764
Harun Ercan Avatar asked Jun 17 '16 16:06

Harun Ercan


1 Answers

No, Inno Setup does not support multi-column (check) list boxes.


But you can easily implement a custom page with look and feel of the standard "Select Additional Tasks" page, just with three separate check list boxes. Then, you can use the Check parameter instead of the Tasks parameter to bind custom tasks to sections likes Files, Icons, etc.

[Files]
Source: "FileForSubTask_0_1.txt"; DestDir: "{app}"; Check: GetCustomTask(0, 1);
Source: "FileForSubTask_0_2.txt"; DestDir: "{app}"; Check: GetCustomTask(0, 2);
...

[Code]

var
  CustomSelectTasksPage: TWizardPage;
  TasksLists: array of TNewCheckListBox;

const
  TaskColumns = 3;

procedure InitializeWizard();
var
  TasksList: TNewCheckListBox;
  I, GapWidth: Integer;
begin
  CustomSelectTasksPage :=
    CreateCustomPage(
      wpSelectTasks, SetupMessage(msgWizardSelectTasks),
      SetupMessage(msgSelectTasksDesc));

  SetArrayLength(TasksLists, TaskColumns);

  GapWidth := ScaleX(16);

  for I := 0 to TaskColumns - 1 do
  begin
    TasksList := TNewCheckListBox.Create(WizardForm);
    TasksList.Width :=
      (CustomSelectTasksPage.SurfaceWidth - (GapWidth * (TaskColumns - 1))) div
        TaskColumns; 
    TasksList.Left := I * (TasksList.Width + GapWidth);
    TasksList.Top := 0;
    TasksList.Height := WizardForm.InnerNotebook.Height - ScaleY(8);

    TasksList.BorderStyle := bsNone;
    TasksList.Color := clBtnFace;
    TasksList.ShowLines := False;
    TasksList.MinItemHeight := ScaleY(22);
    TasksList.ParentColor := True;
    TasksList.WantTabs := True;

    TasksList.Parent := CustomSelectTasksPage.Surface;

    TasksLists[I] := TasksList;
  end;

  TasksLists[0].AddCheckBox('TASK 0:0', '', 0, False, True, False, False, nil);
  TasksLists[0].AddCheckBox('Subtask 0:1', '', 1, False, True, False, False, nil);
  TasksLists[0].AddCheckBox('Subtask 0:2', '', 1, False, True, False, False, nil);

  TasksLists[1].AddCheckBox('TASK 1:0', '', 0, False, True, False, False, nil);
  TasksLists[1].AddCheckBox('Subtask 1:1', '', 1, False, True, False, False, nil);
  TasksLists[1].AddCheckBox('Subtask 1:2', '', 1, False, True, False, False, nil);

  TasksLists[2].AddCheckBox('TASK 2:0', '', 0, False, True, False, False, nil);
  TasksLists[2].AddCheckBox('Subtask 2:1', '', 1, False, True, False, False, nil);
  TasksLists[2].AddCheckBox('Subtask 2:2', '', 1, False, True, False, False, nil);
end;


function GetCustomTask(ListIndex: Integer; TaskIndex: Integer): Boolean;
begin 
  Result := TasksLists[ListIndex].Checked[TaskIndex];
end;

Custom tasks page

like image 180
Martin Prikryl Avatar answered Oct 10 '22 03:10

Martin Prikryl