If you try to update the TasksList
in the InitializeWizard
, you must get the exception as at that point the TasksList
is not populated yet, no matter if the tasks are conditional or not.
The TasksList
is populated only once you move to the "Select Additional Tasks" page.
So you need to update the task caption only in CurPageChanged(wpSelectTasks)
. And test for not WizardIsComponentSelected('Slasher')
(IsComponentSelected
before Inno Setup 6.0.2) before you do so (see the comment in the code for details).
procedure CurPageChanged(CurPageID: Integer);
begin
if CurPageID = wpSelectTasks then
begin
{ This has to be kept in sync with the expression in "Components" parameter }
{ of the respective task. Though note that in your specific case the test }
{ is redundant as when "Slasher" is selected, you have no tasks, }
{ and the "Tasks" page is completely skipped, so you do not even get here. }
{ Before Inno Setup 6.0.2, use IsComponentSelected. }
if not WizardIsComponentSelected('Slasher') then
begin
WizardForm.TasksList.ItemCaption[0] :=
'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed id' + #13#10 +
'venenatis erat, ac vehicula sapien. Etiam convallis ligula eros,' + #13#10 +
'in ullamcorper turpis pulvinar sit amet.';
end;
end;
end;
I'm pretty sure there's no way to change a color of one specific task. All you can do is to create a separate TNewCheckListBox
for each group of tasks that should have a different color (and set the color using its .Font.Color
property).
If you want more details on this, you should ask a separate question. The line break and the color are two separate issues.
See also a similar question: Disable controls based on components selection in Inno Setup.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…