How to create two LicenseFile pages in Inno Setup
我正在为我的应用程序进行 Inno 设置。我正在使用这个命令:
1 2 | [Languages] Name:"english"; MessagesFile:"compiler:Default.isl"; LicenseFile:"C:\\Users\\LocDaiLe\\Desktop\\license.txt" |
显示一个许可协议窗口,但我希望两个许可协议窗口紧挨着彼此。我怎样才能归档这个 - 谢谢
您必须将第二个许可页面编码为自定义页面。
您可以从
1 2 3 4 5 6 | [Files] ; Embed the second license files ; (the part after underscore must match the Name parameter from Languages section) Source:"license2_english.txt"; Flags: dontcopy Source:"license2_czech.txt"; Flags: dontcopy ; Other languages |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 | [Code] var SecondLicensePage: TOutputMsgMemoWizardPage; License2AcceptedRadio: TRadioButton; License2NotAcceptedRadio: TRadioButton; procedure CheckLicense2Accepted(Sender: TObject); begin // Update Next button when user (un)accepts the license WizardForm.NextButton.Enabled := License2AcceptedRadio.Checked; end; function CloneLicenseRadioButton(Source: TRadioButton): TRadioButton; begin Result := TRadioButton.Create(WizardForm); Result.Parent := SecondLicensePage.Surface; Result.Caption := Source.Caption; Result.Left := Source.Left; Result.Top := Source.Top; Result.Width := Source.Width; Result.Height := Source.Height; Result.OnClick := @CheckLicense2Accepted; end; procedure InitializeWizard(); var LicenseFileName: string; LicenseFilePath: string; begin // Create second license page, with the same labels as the original license page SecondLicensePage := CreateOutputMsgMemoPage( wpLicense, SetupMessage(msgWizardLicense), SetupMessage(msgLicenseLabel), SetupMessage(msgLicenseLabel3), ''); // Shrink license box to make space for radio buttons SecondLicensePage.RichEditViewer.Height := WizardForm.LicenseMemo.Height; // Load license // Loading ex-post, as Lines.LoadFromFile supports UTF-8, // contrary to LoadStringFromFile. LicenseFileName := 'license2_' + ActiveLanguage + '.txt'; ExtractTemporaryFile(LicenseFileName); LicenseFilePath := ExpandConstant('{tmp}\' + LicenseFileName); SecondLicensePage.RichEditViewer.Lines.LoadFromFile(LicenseFilePath); DeleteFile(LicenseFilePath); // Clone accept/do not accept radio buttons for the second license License2AcceptedRadio := CloneLicenseRadioButton(WizardForm.LicenseAcceptedRadio); License2NotAcceptedRadio := CloneLicenseRadioButton(WizardForm.LicenseNotAcceptedRadio); // Initially not accepted License2NotAcceptedRadio.Checked := True; end; procedure CurPageChanged(CurPageID: Integer); begin // Update Next button when user gets to second license page if CurPageID = SecondLicensePage.ID then begin CheckLicense2Accepted(nil); end; end; |
原始(第一个)许可页面:
编码(第二个)许可页面:
我还必须显示两个许可证文件,但我通过将这两行添加到设置部分来做到这一点:
1 2 | LicenseFile={#MyFileSource}License.rtf InfoBeforeFile={#MyFileSource}License2.rtf |
对我来说就像一个魅力