Inno设置 - 显示警告页面

时间:2013-07-29 02:54:16

标签: inno-setup

我正在使用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;

不出所料,这不起作用。


以下是要求:

    默认情况下,
  • ImportantTask 将被检查。
  • 如果 ImportantTask 取消选中,则使用风险确认复选框显示 WarningPage
  • 如果未选中风险确认复选框,请停用下一步按钮。

我不想最终得到一个大的[Code]部分,但可能没有其他选择 在此先感谢您的帮助。

1 个答案:

答案 0 :(得分:6)

使用msgbox而不是向导页面。 Msgbox特别用于向用户提供任何指示(info,warning..etc)。
此脚本可根据您的要求运行。

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