2016-12-03 26 views
1

我有一个Information页,在于:与infobefore激活文件的页面:Inno Setup的:确保用户已阅读信息页面

[Setup] 
InfoBeforeFile=infobefore.txt 

我想:

  • 添加一个复选框(或几个复选框),用户必须检查以显示他已注意到信息。

  • 只有当用户选中右边的复选框时才允许用户继续。我想禁用下一步按钮或显示一个消息框,任何更容易。

有没有简单的方法来做到这一点?

回答

1

只需在InfoBeforePage页面上添加一个新复选框。并根据复选框状态更新NextButton状态。

[Setup] 
LicenseFile=infobefore.txt 

[Code] 

var 
    InfoBeforeCheck: TNewCheckBox; 

procedure CheckInfoBeforeRead; 
begin 
    { Enable the NextButton only if InfoBeforeCheck is checked } 
    WizardForm.NextButton.Enabled := InfoBeforeCheck.Checked; 
end; 

procedure InfoBeforeCheckClick(Sender: TObject); 
begin 
    { Update state of the Next button, whenever the InfoBeforeCheck is toggled } 
    CheckInfoBeforeRead; 
end; 

procedure InitializeWizard(); 
begin 
    InfoBeforeCheck := TNewCheckBox.Create(WizardForm); 
    InfoBeforeCheck.Parent := WizardForm.InfoBeforePage; 
    { Follow the License page layout } 
    InfoBeforeCheck.Top := WizardForm.LicenseNotAcceptedRadio.Top; 
    InfoBeforeCheck.Left := WizardForm.LicenseNotAcceptedRadio.Left; 
    InfoBeforeCheck.Width := WizardForm.LicenseNotAcceptedRadio.Width; 
    InfoBeforeCheck.Height := WizardForm.LicenseNotAcceptedRadio.Height; 
    InfoBeforeCheck.Caption := 'I swear I read this'; 
    InfoBeforeCheck.OnClick := @InfoBeforeCheckClick; 

    { Make the gap between the InfoBeforeMemo and the InfoBeforeCheck the same } 
    { as the gap between LicenseMemo and LicenseAcceptedRadio } 
    WizardForm.InfoBeforeMemo.Height := 
    ((WizardForm.LicenseMemo.Top + WizardForm.LicenseMemo.Height) - 
    WizardForm.InfoBeforeMemo.Top) + 
    (InfoBeforeCheck.Top - WizardForm.LicenseAcceptedRadio.Top); 
end; 

procedure CurPageChanged(CurPageID: Integer); 
begin 
    if CurPageID = wpInfoBefore then 
    begin 
    { Initial state of the Next button } 
    CheckInfoBeforeRead; 
    end; 
end; 

I swear I read this