如果用户在安装过程中选中相应的复选框,我想执行一些代码。通过阅读帮助文件,似乎使用该任务的唯一方法是将其与Files
/ Icons
/etc 中的条目相关联。部分。我真的很想将它与本Code
节中的程序相关联。这可以做到吗?如果可以,怎么做?
6996 次
2 回答
12
您不需要定义自己的向导页面。您可以将它们添加到附加任务页面。
[Tasks]
Name: associate; Description:"&Associate .ext files with this version of my program"; \
GroupDescription: "File association:"
[Code]
function NextButtonClick(CurPageID: Integer): Boolean;
begin
Result := True;
if CurPageID = wpSelectTasks then
begin
if WizardIsTaskSelected('taskname') then
MsgBox('First task has been checked.', mbInformation, MB_OK);
else
MsgBox('First task has NOT been checked.', mbInformation, MB_OK);
end;
end;
这篇文章要归功于 TLama 。
于 2012-12-31T12:48:15.137 回答
7
您可以通过添加一个包含复选框的自定义向导页面来做到这一点,并在用户单击该页面上的“下一步”时为所有选定的复选框执行代码:
[Code]
var
ActionPage: TInputOptionWizardPage;
procedure InitializeWizard;
begin
ActionPage := CreateInputOptionPage(wpReady,
'Optional Actions Test', 'Which actions should be performed?',
'Please select all optional actions you want to be performed, then click Next.',
False, False);
ActionPage.Add('Action 1');
ActionPage.Add('Action 2');
ActionPage.Add('Action 3');
ActionPage.Values[0] := True;
ActionPage.Values[1] := False;
ActionPage.Values[2] := False;
end;
function NextButtonClick(CurPageID: Integer): Boolean;
begin
Result := True;
if CurPageID = ActionPage.ID then begin
if ActionPage.Values[0] then
MsgBox('Action 1', mbInformation, MB_OK);
if ActionPage.Values[1] then
MsgBox('Action 2', mbInformation, MB_OK);
if ActionPage.Values[2] then
MsgBox('Action 3', mbInformation, MB_OK);
end;
end;
复选框可以是标准控件或列表框中的项目,有关详细信息,请参阅有关 Pascal 脚本的 Inno Setup 文档。
如果您希望根据是否选择了某个组件或任务来执行您的代码,请改用WizardIsComponentSelected()
andWizardIsTaskSelected()
函数。
于 2010-02-17T15:23:18.917 回答