2016-03-05 100 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

是的,我已經試過了。我想我會問一個新問題。顏色有點重要。 –