在单独的页面上用单选按钮替换Inno Setup安装类型组合框(类似Shield的安装)

用户名

我正在为我的应用程序使用Inno安装程序生成安装程序。

为了使用户能够选择完整安装或紧凑安装,我使用以下代码,

[Types]
Name: "full"; Description: "Full Installation"
Name: "compact"; Description: "Lite Installation"
Name: "custom"; Description: "Custom Installation"; Flags: iscustom

[Components]
Name: "One"; Description: "First"; Types: full compact custom; Flags: fixed
Name: "Two"; Description: "second"; Types: full
Name: "Three"; Description: "Third"; Types: full
Name: "Four"; Description: "Fourth"; Types: full
Name: "Five"; Description: "Fifth"; Types: full

我得到以下UI:

在此处输入图片说明

是否有可能(通过组合框)更改选择“类型”的这种方式

我希望像下面的示例一样选择“类型”。并且,如果用户选择自定义,则他应该能够选择要安装的“组件”。

在此处输入图片说明

马丁·普里克里(Martin Prikryl)

一种方法是使用“类型”菜单实现自定义页面,隐藏标准的“类型”组合框,然后根据用户在自定义菜单中选择的类型来更新其选择。

[Types]
Name: "typical"; Description: "Typical installation"
Name: "complete"; Description: "Complete installation"
Name: "custom"; Description: "Custom installation"; Flags: iscustom

[Components]
Name: "main"; Description: "Main Files"; Types: complete typical custom; Flags: fixed
Name: "help"; Description: "Help Files"; Types: complete
Name: "help\english"; Description: "English"; Types: complete
Name: "help\dutch"; Description: "Dutch"; Types: complete

[Code]

var
  TypesPage: TWizardPage;
  TypicalButton: TNewRadioButton;
  CompleteButton: TNewRadioButton;
  CustomButton: TNewRadioButton;

procedure InitializeWizard();
begin
  { Create custom "types" page }
  TypesPage :=
    CreateCustomPage(
      wpSelectDir, 'Setup Type', 'Choose the setup type that best suits your needs.');

  TypicalButton := TNewRadioButton.Create(TypesPage);
  TypicalButton.Parent := TypesPage.Surface;
  TypicalButton.Caption := 'Typical';
  TypicalButton.Height := ScaleY(TypicalButton.Height);
  TypicalButton.Checked := True; { default, unless other type is selected below }

  CompleteButton := TNewRadioButton.Create(TypesPage);
  CompleteButton.Parent := TypesPage.Surface;
  CompleteButton.Caption := 'Complete';
  CompleteButton.Height := ScaleY(CompleteButton.Height);
  CompleteButton.Top := TypicalButton.Top + TypicalButton.Height + ScaleY(16);
  CompleteButton.Checked := (WizardForm.TypesCombo.ItemIndex = 1);

  CustomButton := TNewRadioButton.Create(TypesPage);
  CustomButton.Parent := TypesPage.Surface;
  CustomButton.Caption := 'Custom';
  CustomButton.Height := ScaleY(CustomButton.Height);
  CustomButton.Top := CompleteButton.Top + CompleteButton.Height + ScaleY(16);
  CompleteButton.Checked := (WizardForm.TypesCombo.ItemIndex = 2);

  { Hide "types" combo }
  WizardForm.TypesCombo.Visible := False;
  WizardForm.IncTopDecHeight(WizardForm.ComponentsList,
    -(WizardForm.ComponentsList.Top - WizardForm.TypesCombo.Top));
end;

function NextButtonClick(CurPageID: Integer): Boolean;
begin
  { When leaving "types" page, update hidden "types" combo box }
  { according to user selection... }
  if CurPageID = TypesPage.ID then
  begin
    if CompleteButton.Checked then WizardForm.TypesCombo.ItemIndex := 1
      else 
    if CustomButton.Checked then WizardForm.TypesCombo.ItemIndex := 2
      else WizardForm.TypesCombo.ItemIndex := 0;
    { .. and have Inno Setup update components selection accordingly }
    WizardForm.TypesCombo.OnChange(WizardForm.TypesCombo);
  end;
  Result := True;
end;

function ShouldSkipPage(PageID: Integer): Boolean;
begin
  { Skip "components" page, unless "custom" type was selected }
  Result := (PageID = wpSelectComponents) and (not CustomButton.Checked);
end;

在此处输入图片说明

在此处输入图片说明


要添加其他图像和标签,请参阅:
Inno Setup在自定义页面上放置图像/控件


有关在“选择组件”页面上显示单选按钮的替代实现,请参阅:
用单选按钮替换安装类型下拉列表

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章

在“ Inno Setup许可证”页面上,用“我同意”按钮替换复选框

为什么在Inno Setup中未选中自定义页面上的单选按钮?

自定义选项页面上现有单选按钮的Inno Setup更改标题

我可以在Inno Setup的同一“ CreateInputOptionPage”页面上使用复选框和单选按钮吗?

Inno Setup:如何使用单选按钮和表单创建页面

Inno Setup禁用同一页面上的两个按钮

Inno Setup在自定义文件夹选择页面上显示安装所需的空间

Inno Setup禁用安装向导页面

Inno Setup“安装完成”向导页面

如何在Inno Setup中将自定义页面上的单选控件分成两个不同的组?

在Inno Setup中单击“下一步”按钮时,验证自定义页面上的数据

Inno Setup安装程序中的嵌入式CMD(在自定义页面上显示命令输出)

如何从Inno Setup安装JRE?

使用Inno Setup安装字体-替换锁定的字体

从Inno Setup安装后的Run部分中打开HTML页面

准备卸载就像准备安装页面-Inno Setup

Inno Setup-自定义安装页面

在Inno Setup中跳过准备安装向导页面

Inno Setup - 在安装页面隐藏进度条

Inno Setup:TInputQueryWizardPage上的组合框

阻止自动继续安装到“完成”页面,并允许返回“安装”页面以查看Inno Setup中的结果

每个用户或每个计算机安装的Inno Setup自定义对话框

使用Inno Setup静默运行安装,无需任何“下一步”按钮或“安装”按钮

Inno Setup-如何根据单选按钮跳过文件

安装后执行批处理文件,并在Inno Setup中“完成”页面之前的自定义页面上显示其输出

由CreateInputQueryPage创建的页面上的Inno Setup中的多行编辑

无法在Inno Setup欢迎页面上创建标签

Inno Setup在自定义页面上放置图像/控件

在Inno Setup安装程序中,卸载InstallShield LE进行的安装