Inno Setup - Change a task description label's color and have a line break

大憨熊 提交于 2019-11-29 08:47:59

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.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!