Inno Setup-更改任务描述标签的颜色并换行 [英] Inno Setup - Change a task description label's color and have a line break

查看:115
本文介绍了Inno Setup-更改任务描述标签的颜色并换行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

[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中找到了 TLama的解决方案 :如何在组件描述中添加换行符,但会导致List index out of bounds(0),因为如您所见,该任务有条件地显示在脚本中.

I need Warning: This will result in... to be displayed on a new line and in red font. I found TLama's solution in InnoSetup: How to add line break into component description but it results in List index out of bounds(0) since, as you can see, the task is displayed conditionally in my script.

推荐答案

如果尝试更新InitializeWizard中的TasksList,则必须获取例外,因为此时尚未填充TasksList,不管任务是否是有条件的.

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.

仅当您移至选择其他任务"页面时,才会填充TasksList.

The TasksList is populated only once you move to the "Select Additional Tasks" page.

因此,您仅需要在 CurPageChanged(wpSelectTasks)中更新任务标题.并在Inno Setup 6.0.2之前测试 not WizardIsComponentSelected('Slasher') (IsComponentSelected ),然后再进行操作(有关详细信息,请参见代码中的注释.)

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;


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


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).

如果您想要更多有关此的详细信息,您应该提出一个单独的问题.换行和颜色是两个单独的问题.

也请参见类似的问题:根据Inno Setup中的组件选择禁用控件..

这篇关于Inno Setup-更改任务描述标签的颜色并换行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆