Replacing Radio Buttons with Check Box on License Wizard Page in Inno Setup

旧时模样 提交于 2020-01-04 23:46:40

问题


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?


回答1:


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.

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;


来源:https://stackoverflow.com/questions/10687135/replacing-radio-buttons-with-check-box-on-license-wizard-page-in-inno-setup

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!