Task flags are actually items in the WizardForm.TasksList checklist. If you know their indexes, you can easily access them. Please note that the elements can be grouped (just your case), and each new group also takes one element in this list, so for your case the index of the element will be 1:
[Setup] AppName=TasksList AppVersion=1.0 DefaultDirName={pf}\TasksList [Tasks] Name: "TaskEntry"; Description: "Description"; GroupDescription: "Group"; [code] function NextButtonClick(CurPageID: Integer): Boolean; begin Result := True; if CurPageID = wpSelectTasks then begin if WizardForm.TasksList.Checked[1] then MsgBox('First task has been checked.', mbInformation, MB_OK) else MsgBox('First task has NOT been checked.', mbInformation, MB_OK); end; end; procedure CurPageChanged(CurPageID: Integer); begin if CurPageID = wpSelectTasks then WizardForm.TasksList.Checked[1] := False; end;
This is how the WizardForm.TasksList validation WizardForm.TasksList will look when you have two tasks with different groups:

To access the task, according to its description, try the following:
[Setup] AppName=Task List AppVersion=1.0 DefaultDirName={pf}\TasksList [Tasks] Name: "Task"; Description: "Task Description"; GroupDescription: "Group 1"; [code] function NextButtonClick(CurPageID: Integer): Boolean; var Index: Integer; begin Result := True; if CurPageID = wpSelectTasks then begin Index := WizardForm.TasksList.Items.IndexOf('Task Description'); if Index <> -1 then begin if WizardForm.TasksList.Checked[Index] then MsgBox('First task has been checked.', mbInformation, MB_OK) else MsgBox('First task has NOT been checked.', mbInformation, MB_OK); end; end; end; procedure CurPageChanged(CurPageID: Integer); var Index: Integer; begin if CurPageID = wpSelectTasks then begin Index := WizardForm.TasksList.Items.IndexOf('Task Description'); if Index <> -1 then WizardForm.TasksList.Checked[Index] := False; end; end;
TLama
source share