I made an installer with 4 task-groups, and each group has like 30-40 checkeable tasks, it's a little bit insane to uncheck all the tasks manually, and I don't want to set a Component
because the intention is give free choice to select/check/uncheck whatever tasks you want to perform in the installer, I think a Component
could be a bad approach for this installer.
Then, I would like to know if I could add a checkbox titled "Check all" at the top of each tasks-group that will check or uncheck all the tasks inside that tasks-gruop, and that checkbox alternates the name to "Uncheck all" to do the opposite thing.
How I could do this?, is necessary to use pascal code?
One way is building a task hierarchy, which can be done by writing paths built from the Name
parameters of your task entries separated by \
, or /
chars. This is quite hidden in the Name
parameter documentation:
The total number of \ or / characters in the name of the task is called the level of the task. Any task with a level of 1 or more is a child task. The task listed before the child task with a level of 1 less than the child task, is the parent task. Other tasks with the same parent task as the child task are sibling tasks.
For example, to make a hierarchy of a parent, child and subchild you could write:
[Tasks]
Name: parent; Description: "Parent task"; Flags: unchecked
Name: parent\child; Description: "Child task"; Flags: unchecked
Name: parent\child\subchild; Description: "Subchild task"; Flags: unchecked
And the tasks page will produce this:
Tasks built in hierarchy by default inherit check states (unless you specify dontinheritcheck
flag for your child task entries), so for your overall aim you may write something like this:
[Setup]
AppName=My Program
AppVersion=1.5
DefaultDirName={pf}\My Program
[Tasks]
Name: group1; Description: "Check/uncheck all"; GroupDescription: "1. Group description"; Flags: unchecked
Name: group1\task1; Description: "1. Task"; Flags: unchecked
Name: group1\task2; Description: "2. Task"; Flags: unchecked
Name: group1\task3; Description: "3. Task"; Flags: unchecked
Name: group2; Description: "Check/uncheck all"; GroupDescription: "2. Group description"; Flags: unchecked
Name: group2\task1; Description: "1. Task"; Flags: unchecked
Name: group2\task2; Description: "2. Task"; Flags: unchecked
Name: group2\task3; Description: "3. Task"; Flags: unchecked
And the tasks page will produce this: