我想知道,当我没有任务或组件时,如何使用Uninstallable
指令:
[Setup]
Uninstallable:not if IscomponentSelected ('comp1 comp2')
我没有创建任务或组件。我只创建了一些带有“可移植”选项的复选框,当我选中该选项时,我想添加可卸载选项:
[Code]
var
Component: TWizardPage;
portable,installer: TNewRadioButton;
Copmp: TLabel;
function install: Boolean;
begin
Result := installer.Checked;
end;
function portab: Boolean;
begin
Result := portable.Checked;
end;
procedure InitializeWizard();
begin
Component :=
CreateCustomPage(
wpSelectDir, 'Component Selection',
'Which types and components would you like to install?');
CompPanel := TPanel.Create(WizardForm);
with CompPanel do
begin
Parent := Component.Surface;
Left := ScaleX(0);
Top := ScaleY(0);
Width := ScaleX(417);
Height := ScaleY(100);
BevelOuter := bvNone;
end;
Copmp := TLabel.Create(WizardForm);
with Copmp do
begin
Parent := CompPanel;
Caption := 'Type and components:';
Left := ScaleX(0);
Top := ScaleY(5);
Width := ScaleX(150);
Height := ScaleY(13);
end;
portable := TNewRadioButton.Create(WizardForm);
with portable do
begin
Parent := CompPanel;
Left := ScaleX(5);
Top := ScaleY(25);
Width := ScaleX(200);
Height := ScaleY(17);
Caption := 'Unpacking';
OnClick:=@CopmpClick;
end;
installer :=
TNewRadioButton.Create(WizardForm);
with installer do
begin
Parent := CompPanel;
Left := ScaleX(5);
Top := ScaleY(45);
Width := ScaleX(200);
Height := ScaleY(17);
Caption := 'Install';
OnClick:=@CopmpClick;
Checked:=True;
end;
答案 0 :(得分:1)
只需实现自定义功能:
function IsUninstallable: Boolean;
begin
Result := installer.Checked;
end;
并在Uninstallable
指令中使用它:
[Setup]
Uninstallable=IsUninstallable