Today we will describe a process of creating custom wizard page in program installer. Though Inno Setup suggests pages which will cover your needs in most of the cases, sometimes you will need to create your own page during installation process.
Custom page can be created in [Code] section in InitializeWizard function:
[Code]
procedure InitializeWizard();
begin
authentication_form_CreatePage(wpLicense);
end;
wpLicense argument means that our custom page will be displayed after standard license page during installation process. All standard wizard pages have their predefined IDs. For instance, welcome page have ID equal to wpWelcome.
Now let’s look at the code which is creating custom page. First we need to define some variables which will be used:
var
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
Label4: TLabel;
ServerNameEdit: TEdit;
WindowsRadioButton: TRadioButton;
SqlRadioButton: TRadioButton;
UserEdit: TEdit;
PasswordEdit: TEdit;
And this is the function itself. In it you will need to create all the necessary controls like labels, buttons, etc.:
function authentication_form_CreatePage(PreviousPageId: Integer): Integer;
var
Page: TWizardPage;
begin
Page := CreateCustomPage(
PreviousPageId,
ExpandConstant('{cm:authentication_form_Caption}'),
ExpandConstant('{cm:authentication_form_Description}')
);
Label1 := TLabel.Create(Page);
w