【问题标题】:Inno Setup - Change a task description label's color and have a line breakInno Setup - 更改任务描述标签的颜色并换行
【发布时间】:2016-03-05 17:23:47
【问题描述】:
[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 pascalscript


    【解决方案1】:

    如果您尝试更新InitializeWizard 中的TasksList,则必须收到异常,因为此时TasksList 尚未填充,无论任务是否有条件。

    TasksList 仅在您移至“选择其他任务”页面后才会填充。

    所以您只需要更新CurPageChanged(wpSelectTasks) 中的任务标题。并在执行此操作之前测试not WizardIsComponentSelected('Slasher')(Inno Setup 6.0.2 之前的IsComponentSelected)(有关详细信息,请参阅代码中的注释)。

    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;
    

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


    如果您想了解更多详细信息,您应该提出一个单独的问题。换行和颜色是两个独立的问题。

    另见类似问题:Disable controls based on components selection in Inno Setup

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-02-11
      • 2021-11-05
      • 1970-01-01
      相关资源
      最近更新 更多