2016-03-05 68 views
1
[Components] 
Name: "Slasher"; Description: "Dagon Slasher"; Types: Slasher Full 
Name: "Frankenstein"; Description: "Dagon Frankenstein"; Types: Frankenstein Full 

[Types] 
Name: "Full"; Description: "Dagon Video Tools" 
Name: "Slasher"; Description: "Dagon Slasher" 
Name: "Frankenstein"; Description: "Dagon FrankenStein" 

[Tasks] 
Name: "Debug"; Description: "Debug. Warning: This will result in a non-functional ""Join in FrankenStein"" button in the Tools Menu."; Components: not Slasher 
Name: "Vid"; Description: "Install Extra Codecs for Frankenstein"; Flags: unchecked; Components: not Slasher 

我需要Warning: This will result in...以新行和红色字体显示。我在InnoSetup: How to add line break into component description中发现了TLama's solution,但是它的结果是List index out of bounds(0),因为您可以看到,该任务在我的脚本中有条件地显示。Inno Setup - 更改任务描述标签的颜色并换行

回答

1

如果您尝试更新InitializeWizard中的TasksList,那么无论任务是否有条件,您都必须获得异常,因为此时尚未填充TasksList

只有在移到“选择其他任务”页面时,才会填充TasksList

因此,您只需在CurPageChanged(wpSelectTasks)中更新任务标题。并在测试之前先测试not IsComponentSelected('Slasher')(有关详细信息,请参阅代码中的注释)。

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. } 
    if not IsComponentSelected('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; 

我敢肯定,有没有办法改变一个特定的任务的颜色。你所能做的就是为应该有不同颜色的每组任务创建一个单独的TNewCheckListBox(并使用其属性.Font.Color设置颜色)。

如果你想了解更多细节,你应该问一个单独的问题。换行符和颜色是两个独立的问题。

+0

是的,我已经试过了。我想我会问一个新问题。颜色有点重要。 –