Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
509 views
in Technique[技术] by (71.8m points)

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

[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

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.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

1.4m articles

1.4m replys

5 comments

56.8k users

...