4

我正在使用 Inno Script Studio 构建安装程序,到目前为止非常成功,因为 Inno Setup 是一个很棒的软件包。

但是,我想添加一个警告页面,当用户取消选中一个重要任务时会显示该警告页面。我认为这只是一个简单的检查。经过一番谷歌搜索后,我意识到这将需要一些 Pascal 脚本 - 不幸的是我不知道的东西(下面的证据)......

begin
  if not IsTaskSelected('ImportantTask') then
    WarningPage := CreateOutputMsgPage(wpSelectTasks, 'Caution',
    'Please read the following important information before continuing.',
    'You have not selected the ImportantTask option. Click "Back" to
    reselect ImportantTask, or click "Next" to continue at your own risk.');
  end;

不出所料,这没有奏效。


以下是要求:

  • 重要任务是默认选中的。
  • 如果未选择重要任务,则显示带有风险确认复选框的警告页面。
  • 如果未勾选风险确认复选框,请禁用下一步按钮。

我不想以大的 [Code] 部分结束,但可能没有其他选择。
在此先感谢您的帮助。

4

1 回答 1

6

使用 msgbox 的替代向导页面。Msgbox 特别用于向用户提供任何指示(信息、警告..等)。
此脚本根据您的要求工作。

[Setup]
AppName=MySetup 
AppVersion=1.5
DefaultDirName={pf}\MySetup 
[Tasks]
Name: "ImportantTask"; Description: "This task should be selected"; GroupDescription: "Important tasks";
[Code]
function NextButtonClick(CurPageID: Integer): Boolean;
begin
  Result := True;
  if (CurPageID = wpSelectTasks) and not IsTaskSelected('ImportantTask') then
    Result := Msgbox('You have not selected the ImportantTask option.' + #13#10 + 
      'Are you sure you want to continue ?', mbInformation, MB_YESNO) = IDYES;
end;

归功于 TLama...

于 2013-07-29T04:07:17.353 回答