我正在开发一个InnoSetup项目,我想知道如何总是安装一个组件(让我们说'Acrobat Reader'),但不允许在组件列表中取消选中该项.
我不希望用户取消选中它.
通常,当所选安装类型在Types其条目的参数中列出时,将选择组件.因此,如果列出所有可用的安装类型,将始终选中它.
要禁用组件以便用户无法修改其状态,您需要包含fixed该条目的标志.
因此,要创建一个禁用的,始终选择的具有默认安装类型的组件(在本[Types]节中未指定自己的安装类型时使用),您可以编写如下条目:
[Components]
Name: "main"; Description: "Main Files"; Types: full compact custom; Flags: fixed
Run Code Online (Sandbox Code Playgroud)
在您的评论中,您已经询问了如何禁用任务条目.据我所知,没有直接的方法可以做到这一点,我能想出的唯一方法是在CurPageChanged事件的代码中执行此操作:
[Setup]
AppName=My Program
AppVersion=1.5
DefaultDirName={pf}\My Program
[Tasks]
Name: something; Description: "Install something"
[Code]
procedure CurPageChanged(CurPageID: Integer);
begin
// the ItemEnabled property uses a 0 based index for item access, so the following
// code you can read as, if we have entered the tasks selection page, disable the
// first tasks list item
if CurPageID = wpSelectTasks then
WizardForm.TasksList.ItemEnabled[0] := False;
end;
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1950 次 |
| 最近记录: |