Inno Setup 中的条件 DisableProgramGroupPage
Conditional DisableProgramGroupPage in Inno Setup
我正在尝试为普通安装和便携式安装创建一个安装程序。对于便携式安装,我将禁用所有图标和卸载程序创建。
我遇到的唯一问题是如何在 运行 便携式安装时禁用程序组页面。我是不是误会了什么?
[Setup]
;This works as expected
Uninstallable=not IsPortable()
;This does NOT work, can't compile (DisableProgramGroupPage=yes alone compiles fine)
DisableProgramGroupPage=yes IsPortable()
编译失败并出现错误
Value of [Setup] section directive ... is invalid.
这是IsPortable()
函数:
function IsPortable(): Boolean;
begin
if(StandardRadioButton.Checked = True) then
Result := False
else
Result := True;
end;
(详细说明@TLama 的评论)
DisableProgramGroupPage
不支持"boolean expression":
[Setup]: DisableProgramGroupPage
Valid values: auto
, yes
, or no
与Uninstallable
相反:
[Setup]: Uninstallable
Valid values: yes
or no
, or a boolean expression
您可以使用 ShouldSkipPage
event function 代替:
function ShouldSkipPage(PageID: Integer): Boolean;
begin
Result := False;
if PageID = wpSelectProgramGroup then
begin
Result := IsPortable;
end;
end;
我正在尝试为普通安装和便携式安装创建一个安装程序。对于便携式安装,我将禁用所有图标和卸载程序创建。
我遇到的唯一问题是如何在 运行 便携式安装时禁用程序组页面。我是不是误会了什么?
[Setup]
;This works as expected
Uninstallable=not IsPortable()
;This does NOT work, can't compile (DisableProgramGroupPage=yes alone compiles fine)
DisableProgramGroupPage=yes IsPortable()
编译失败并出现错误
Value of [Setup] section directive ... is invalid.
这是IsPortable()
函数:
function IsPortable(): Boolean;
begin
if(StandardRadioButton.Checked = True) then
Result := False
else
Result := True;
end;
(详细说明@TLama 的评论)
DisableProgramGroupPage
不支持"boolean expression":
[Setup]: DisableProgramGroupPage
Valid values:auto
,yes
, orno
与Uninstallable
相反:
[Setup]: Uninstallable
Valid values:yes
orno
, or a boolean expression
您可以使用 ShouldSkipPage
event function 代替:
function ShouldSkipPage(PageID: Integer): Boolean;
begin
Result := False;
if PageID = wpSelectProgramGroup then
begin
Result := IsPortable;
end;
end;