On this support page for creating a custom 'CreateInputOptionPage', they suggest storing the values of the page by just assigning them to a variable. Its not clear however WHEN this assignment should happen.'
From what I can tell, if you assign this right when you create the page, you will get the default value. This makes sense as when the page is created, user hasn't input any "Input Query"'s yet.
Therefore, I reasoned to assign the values from the page to a variable when the 'Next' button is clicked, using function NextButtonClick(CurPageID: Integer): Boolean;
In order to do that, I needed to access the page's variable (Page.Values[0]
) in the NextButtonClick
function. Since Page was defined in a different function, is the only way to access those values to have Page be a global variable? That's what I've resolved to do but I was wondering if anyone out there had an alternative to global variables.
Stub of my code so far.
; Script generated by the Inno Setup Script Wizard.
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!
#define MyAppName "O"
#define MyAppVersion "0.0"
#define MyAppPublisher "O."
#define MyAppURL "http://www.o.com/"
[Setup]
; NOTE: The value of AppId uniquely identifies this application.
; Do not use the same AppId value in installers for other applications.
; (To generate a new GUID, click Tools | Generate GUID inside the IDE.)
AppId={{ED5F31B8-32DD-4175-833A-C6D7CBD90DD9}
AppName={#MyAppName}
AppVersion={#MyAppVersion}
DefaultDirName={sd}\{#MyAppName}
AllowNoIcons=yes
OutputDir={desktop}
OutputBaseFilename=dummy
Compression=lzma
SolidCompression=yes
[code]
var
Page: TInputOptionWizardPage;
InstallationTypeIsClient: boolean;
procedure InitializeWizard();
begin
Page := CreateInputOptionPage(wpWelcome,'Installation Type', 'Select Installation Type', 'No really, do some selecting', True, False)
Page.Add('Server Install');
Page.Add('Client Install');
Page.Values[1] := True;
end;
function NextButtonClick(CurPageID: Integer): Boolean;
begin
if CurPageID=100 then
begin
InstallationTypeIsClient := Page.Values[1];
MsgBox('InstallationTypeIsClient value is ' + Format('%d', [InstallationTypeIsClient]), mbInformation, MB_OK);
end;
Result := True;
end;