基于自定义复选框值的Inno Setup Set Uninstallable指令 [英] Inno Setup Set Uninstallable directive based on custom checkbox value

查看:89
本文介绍了基于自定义复选框值的Inno Setup Set Uninstallable指令的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道在没有任务或组件时如何使用Uninstallable指令:

I want to know, how to use Uninstallable directive, when I don't have tasks or components:

[Setup]
Uninstallable:not if IscomponentSelected ('comp1 comp2')

我没有创建任务或组件.我只是创造了一些复选框以便携"的选项,这是我要添加卸载的选项,当一个被选中:

I don't have tasks or components created. I only created some checkboxes with a "portable" option, which I want to add uninstallable option, when that one is checked:

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

推荐答案

只需实现一个自定义函数:

Just implement a custom function:

function IsUninstallable: Boolean;
begin
  Result := installer.Checked;
end;

并在Uninstallable指令中使用它:

[Setup]
Uninstallable=IsUninstallable

这篇关于基于自定义复选框值的Inno Setup Set Uninstallable指令的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆