在Inno Setup中的许可证向导页上替换单选按钮与复选框 [英] Replacing Radio Buttons with Check Box on License Wizard Page in Inno Setup

查看:941
本文介绍了在Inno Setup中的许可证向导页上替换单选按钮与复选框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有简单的方法来取代许可证向导页上的标准2单选按钮与Inno设置中的单个(选中/未选中)复选框whithout创建自定义页面?

Is there any easy way to replace standard 2 radio buttons on License Wizard Page with single (checked/unchecked) Check Box in Inno Setup whithout creating Custom Page?

推荐答案

由于没有设置可以在许可证单选按钮和一些许可证复选框之间切换(至少只是因为没有组件它在 WizardForm )您需要自己创建它。

Since there are no settings to switch between license radio buttons and some license check box (at least just because there's no component for it on the WizardForm) you need to create it by your own.

以下代码隐藏原始许可证单选按钮,并在向导初始化的同一位置创建一个复选框。此许可证复选框模拟其 OnClick 事件处理程序中的单选按钮选择,以保持其原始功能。这里是代码,它允许您访问许可证复选框超出向导初始化事件的范围。如果稍后不需要访问此复选框,则可以使用 此版本

The following code hide the original license radio buttons and creates a check box on the same place at the wizard initialization. This license check box is simulating the radio buttons selections in its OnClick event handler to keep their original functionality. Here is the code, which allows you to access the license check box out of the scope of the wizard initialization event. If you don't need to access this check box later on, you can use this version of the post:

[code]

var
  LicenseCheckBox: TNewCheckBox;

procedure OnLicenseCheckBoxClick(Sender: TObject);
var
  LicenseAccepted: Boolean;
begin
  LicenseAccepted := (Sender as TNewCheckBox).Checked;
  WizardForm.LicenseAcceptedRadio.Checked := LicenseAccepted;
  WizardForm.LicenseNotAcceptedRadio.Checked := not LicenseAccepted;
end;

procedure InitializeWizard;
begin
  WizardForm.LicenseAcceptedRadio.Hide;
  WizardForm.LicenseNotAcceptedRadio.Hide;

  LicenseCheckBox := TNewCheckBox.Create(WizardForm);
  LicenseCheckBox.Parent := WizardForm.LicensePage;
  LicenseCheckBox.Left := 0;
  LicenseCheckBox.Top := WizardForm.LicenseMemo.Top + 
    WizardForm.LicenseMemo.Height + 8;
  LicenseCheckBox.Width := WizardForm.LicenseMemo.Width;
  LicenseCheckBox.Caption := ' I accept the license agreement';
  LicenseCheckBox.OnClick := @OnLicenseCheckBoxClick;
end;

这篇关于在Inno Setup中的许可证向导页上替换单选按钮与复选框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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