Additional licence pages


Jump to: navigation, search

Some times, it is necassary to get the user to agree to additional licences during an install. Inno only includes one native licence page, but it's easy enough to adjust a TOutputMsgMemoWizardPage to do the same job by resizing the memo box and adding the agree/disagree boxes.

; Shows a new license page for the LGPL with the usual accept/don't acccept options
  LGPLPage: TOutputMsgMemoWizardPage;
  LGPLAccept: TNewRadioButton;
  LGPLRefuse: TNewRadioButton;

procedure LGPLPageActivate(Sender: TWizardPage); forward;
procedure LGPLAcceptClick(Sender: TObject); forward;

procedure LGPL_InitializeWizard();
  LGPLText: AnsiString;

  // Create the page
  LGPLPage := CreateOutputMsgMemoPage(wpLicense, SetupMessage(msgWizardLicense), SetupMessage(msgLicenseLabel), CustomMessage('LGPLHeader'), '');

  // Adjust the memo and add the confirm/refuse options
  LGPLPage.RichEditViewer.Height := ScaleY(148);
  LGPLAccept := TNewRadioButton.Create(LGPLPage);
  LGPLAccept.Left := LGPLPage.RichEditViewer.Left;
  LGPLAccept.Top := LGPLPage.Surface.ClientHeight - ScaleY(41);
  LGPLAccept.Width := LGPLPage.RichEditViewer.Width;
  LGPLAccept.Parent := LGPLPage.Surface;
  LGPLAccept.Caption := SetupMessage(msgLicenseAccepted);
  LGPLRefuse := TNewRadioButton.Create(LGPLPage);
  LGPLRefuse.Left := LGPLPage.RichEditViewer.Left;
  LGPLRefuse.Top := LGPLPage.Surface.ClientHeight - ScaleY(21);
  LGPLRefuse.Width := LGPLPage.RichEditViewer.Width;
  LGPLRefuse.Parent := LGPLPage.Surface;
  LGPLRefuse.Caption := SetupMessage(msgLicenseNotAccepted);
  // Set the states and event handlers
  LGPLPage.OnActivate := @LGPLPageActivate;
  LGPLAccept.OnClick := @LGPLAcceptClick;
  LGPLRefuse.OnClick := @LGPLAcceptClick;
  LGPLRefuse.Checked := true;
  // Load the LGPL text into the new page
  LoadStringFromFile(ExpandConstant('{tmp}/lgpl-3.0.txt'), LGPLText);
  LGPLPage.RichEditViewer.RTFText := LGPLText;

procedure LGPLPageActivate(Sender: TWizardPage);
  WizardForm.NextButton.Enabled := LGPLAccept.Checked;

procedure LGPLAcceptClick(Sender: TObject);
  WizardForm.NextButton.Enabled := LGPLAccept.Checked;

Source: {#Common}Setups\lgpl-3.0.txt; DestDir: {app}; Flags: ignoreversion

LGPLHeader=Please read the following License Agreement. Some components are licensed under the GNU Lesser General Public License.

To create this page, you just need to call LGPL_InitializeWizard from your real InitializeWizard event function, and the two events deal with setting the next button state. This code will need to be repeated (with extra var names) for each additional page you want to add.

Personal tools