The image I am not allowed to resize the image I am using for the MainPanel. This is causing issues, as it is covering an input query page I have created. How do I make sure the input query page with "grow" with the size dimensions set by the MainPanel image?
procedure InitializeWizard;
begin
{ Extract the banner so we can use it with the input page. }
BannerImage := TBitmapImage.Create(WizardForm);
BannerImage.Bitmap.LoadFromFile('C:\temp\tempbanner.bmp');
{ Create the Bitmap Banner img to show on the Main Panel. }
BannerImage.Parent := WizardForm.MainPanel;
WizardForm.MainPanel.Width := SPLASH_SCREEN_WIDTH;
WizardForm.MainPanel.Height := BANNER_HEIGHT;
BannerImage.Width := WizardForm.MainPanel.Width;
BannerImage.Height := WizardForm.MainPanel.Height;
{ BannerImage.Anchors := [akLeft, akTop, akRight, akBottom]; }
BannerImage.Stretch := False;
BannerImage.AutoSize := False;
WizardForm.WizardSmallBitmapImage.Visible := False;
WizardForm.PageDescriptionLabel.Visible := False;
WizardForm.PageNameLabel.Visible := False;
{ Create the input page }
ReportingServerPage := CreateInputQueryPage(wpWelcome,
'Title', 'What is your XXX?',
'Please enter your Server URL, then click Next.'+#13#10+#13#10+'If you proceed without entering a URL, you can update it in the %AppData%\xxxxxxxx\xxxx\xxxxx\xxxx_launcher.properties file at a later stage.');
ReportingServerPageId := ReportingServerPage.ID;
{ Add items (False means it's not a password edit) }
ReportingServerPage.Add('&Reporting Server URL:', False);
end;
You have to increase window height and move the window contents (Bevel1 and InnerNotebook) down.
Note that the bottom aligned controls (the bottom buttons) move automatically with the window height increase (assuming you use the latest version of Inno Setup).
[Files]
Source: "banner.bmp"; Flags: dontcopy
[Code]
var
ReportingServerPage: TInputQueryWizardPage;
procedure InitializeWizard;
var
BannerImage: TBitmapImage;
Delta: Integer;
begin
BannerImage := TBitmapImage.Create(WizardForm);
ExtractTemporaryFile('banner.bmp');
BannerImage.AutoSize := True;
BannerImage.Bitmap.LoadFromFile(ExpandConstant('{tmp}\banner.bmp'));
BannerImage.Parent := WizardForm.InnerPage;
BannerImage.Left := 0;
BannerImage.Top := 0;
Delta := BannerImage.Height - WizardForm.Bevel1.Top;
WizardForm.Height := WizardForm.Height + Delta;
WizardForm.Bevel1.Top := WizardForm.Bevel1.Top + Delta;
WizardForm.InnerNotebook.Top := WizardForm.InnerNotebook.Top + Delta;
WizardForm.InnerNotebook.Height := WizardForm.InnerNotebook.Height - Delta;
WizardForm.MainPanel.Visible := False;
{ Create the input page }
ReportingServerPage := CreateInputQueryPage(wpWelcome,
'Title', 'What is your XXX?',
'Please enter your Server URL, then click Next.'+#13#10+#13#10+
'If you proceed without entering a URL, you can update it in the ' +
'%AppData%\xxxxxxxx\xxxx\xxxxx\xxxx_launcher.properties file at a later stage.');
{ Add items (False means it's not a password edit) }
ReportingServerPage.Add('&Reporting Server URL:', False);
end;
Note that the code does not cater for image/window width. It assumes the image width fits the window width.
Related
I have created a custom form to display an options page, which I am trying to position in the centre of wherever the WizardForm is at the time an Options button is clicked. I have tried the following code, but it is not positioning it as described.
[Code]
var
OptionsWindowForm: TForm;
{ Show the Options window }
procedure ShowOptionsWindow;
begin
OptionsWindowForm := TForm.Create(nil);
with OptionsWindowForm do
begin
Parent := WizardForm;
BorderStyle := bsDialog;
Position := poMainFormCenter;
ClientWidth := ScaleX(400);
ClientHeight := ScaleY(140);
Caption := '{#AppName} Options';
ShowModal;
end;
end;
I also tried poOwnerFormCenter for the Position property and by setting Left and Top properties, which seem to be ignored.
Is there a way to position this as described?
It indeed does not seem to work as expected.
Though this seems to work:
OptionsWindowForm := TForm.Create(WizardForm); { Make WizardForm the owner }
with OptionsWindowForm do
begin
Position := poOwnerFormCenter; { Center on the owner }
{ ... }
ShowModal;
end;
How can I capture changes in text box value?
I'm researching how to use OnChange event function but i don't know how to use it.
[Code]
var
Page: TInputQueryWizardPage;
procedure InitializeWizard();
begin
Page := CreateInputQueryPage(wpWelcome,
'Personal Information', 'Who are you?',
'Please specify your name and the company for whom you work, then click Next.');
Page.Add('Server:', False);
Page.Add('NAME:', False);
Page.Add('LOCATION:', False);
Page.Values[0] := ('test0');
Page.Values[1] := ('test1');
Page.Values[2] := ('string')+Page.Values[0]+('string')+Page.Values[1];
end;
Handle OnChange event like:
var
Page: TInputQueryWizardPage;
procedure EditChange(Sender: TObject);
begin
Page.Values[2] := 'string' + Page.Values[0] + 'string' + Page.Values[1];
end;
procedure InitializeWizard();
begin
Page := CreateInputQueryPage(...);
Page.Add('Server:', False);
Page.Add('NAME:', False);
Page.Add('LOCATION:', False);
Page.Values[0] := 'test0';
Page.Values[1] := 'test1';
Page.Edits[0].OnChange := #EditChange;
Page.Edits[1].OnChange := #EditChange;
{ Reflect the initial values }
EditChange(nil);
end;
Note that the Edit[2] can be changed by the user, so maybe you want to set it read only.
Page.Edits[2].ReadOnly := True;
Page.Edits[2].Color := clBtnFace;
Or you may actually want to use TLabel instead.
I have added new checkboxes to my inno setup tasks page but i dont know how to make them work with the tasks, i want them to work with the [Tasks] zone in the script.
[Tasks]
Name: "Newcheckboox1"; Description: "Newcheckbox1"; MinVersion: 0.0,5.0
Name: "Newcheckboox2"; Description: "Newcheckbox2"; MinVersion: 0.0,5.0
other tasks checkboxes here.........
Here an image:
Here the code generated when the checkboxes are added:
[Code]
{ RedesignWizardFormBegin } // Don't remove this line!
// Don't modify this section. It is generated automatically.
var
NewGroupBox1: TNewGroupBox;
NewCheckBox1: TNewCheckBox;
NewCheckBox2: TNewCheckBox;
NewCheckBox3: TNewCheckBox;
NewGroupBox2: TNewGroupBox;
NewCheckBox4: TNewCheckBox;
NewCheckBox5: TNewCheckBox;
NewGroupBox3: TNewGroupBox;
NewCheckBox6: TNewCheckBox;
NewCheckBox7: TNewCheckBox;
NewCheckBox8: TNewCheckBox;
procedure RedesignWizardForm;
begin
with WizardForm.SelectTasksLabel do
begin
Visible := False;
Left := ScaleX(392);
end;
{ NewGroupBox1 }
NewGroupBox1 := TNewGroupBox.Create(WizardForm);
with NewGroupBox1 do
begin
Parent := WizardForm.SelectTasksPage;
Left := ScaleX(0);
Top := ScaleY(0);
Width := ScaleX(145);
Height := ScaleY(238);
Caption := 'NewGroupBox1';
end;
{ NewCheckBox1 }
NewCheckBox1 := TNewCheckBox.Create(WizardForm);
with NewCheckBox1 do
begin
Parent := NewGroupBox1;
Left := ScaleX(8);
Top := ScaleY(16);
Width := ScaleX(97);
Height := ScaleY(17);
Caption := 'NewCheckBox1';
end;
{ NewCheckBox2 }
NewCheckBox2 := TNewCheckBox.Create(WizardForm);
with NewCheckBox2 do
begin
Parent := NewGroupBox1;
Left := ScaleX(8);
Top := ScaleY(40);
Width := ScaleX(97);
Height := ScaleY(17);
Caption := 'NewCheckBox2';
end;
{ NewCheckBox3 }
NewCheckBox3 := TNewCheckBox.Create(WizardForm);
with NewCheckBox3 do
begin
Parent := NewGroupBox1;
Left := ScaleX(8);
Top := ScaleY(64);
Width := ScaleX(97);
Height := ScaleY(17);
Caption := 'NewCheckBox3';
end;
NewCheckBox1.TabOrder := 0;
NewCheckBox2.TabOrder := 1;
NewCheckBox3.TabOrder := 2;
{ NewGroupBox2 }
NewGroupBox2 := TNewGroupBox.Create(WizardForm);
with NewGroupBox2 do
begin
Parent := WizardForm.SelectTasksPage;
Left := ScaleX(152);
Top := ScaleY(0);
Width := ScaleX(265);
Height := ScaleY(97);
Caption := 'NewGroupBox2';
end;
{ NewCheckBox4 }
NewCheckBox4 := TNewCheckBox.Create(WizardForm);
with NewCheckBox4 do
begin
Parent := NewGroupBox2;
Left := ScaleX(8);
Top := ScaleY(16);
Width := ScaleX(97);
Height := ScaleY(17);
Caption := 'NewCheckBox4';
end;
{ NewCheckBox5 }
NewCheckBox5 := TNewCheckBox.Create(WizardForm);
with NewCheckBox5 do
begin
Parent := NewGroupBox2;
Left := ScaleX(8);
Top := ScaleY(40);
Width := ScaleX(97);
Height := ScaleY(17);
Caption := 'NewCheckBox5';
end;
NewCheckBox4.TabOrder := 0;
NewCheckBox5.TabOrder := 1;
{ NewGroupBox3 }
NewGroupBox3 := TNewGroupBox.Create(WizardForm);
with NewGroupBox3 do
begin
Parent := WizardForm.SelectTasksPage;
Left := ScaleX(152);
Top := ScaleY(96);
Width := ScaleX(265);
Height := ScaleY(142);
Caption := 'NewGroupBox3';
end;
{ NewCheckBox6 }
NewCheckBox6 := TNewCheckBox.Create(WizardForm);
with NewCheckBox6 do
begin
Parent := NewGroupBox3;
Left := ScaleX(16);
Top := ScaleY(24);
Width := ScaleX(97);
Height := ScaleY(17);
Caption := 'NewCheckBox6';
end;
{ NewCheckBox7 }
NewCheckBox7 := TNewCheckBox.Create(WizardForm);
with NewCheckBox7 do
begin
Parent := NewGroupBox3;
Left := ScaleX(16);
Top := ScaleY(48);
Width := ScaleX(97);
Height := ScaleY(17);
Caption := 'NewCheckBox7';
end;
{ NewCheckBox8 }
NewCheckBox8 := TNewCheckBox.Create(WizardForm);
with NewCheckBox8 do
begin
Parent := NewGroupBox3;
Left := ScaleX(16);
Top := ScaleY(72);
Width := ScaleX(97);
Height := ScaleY(17);
Caption := 'NewCheckBox8';
end;
NewCheckBox6.TabOrder := 0;
NewCheckBox7.TabOrder := 1;
NewCheckBox8.TabOrder := 2;
NewGroupBox1.TabOrder := 2;
NewGroupBox2.TabOrder := 3;
NewGroupBox3.TabOrder := 4;
{ ReservationBegin }
// This part is for you. Add your specialized code here.
{ ReservationEnd }
end;
// Don't modify this section. It is generated automatically.
{ RedesignWizardFormEnd } // Don't remove this line!
procedure InitializeWizard();
begin
RedesignWizardForm;
end;
You cannot "make them work with Tasks". That does not make sense. The only purpose of Tasks is to automatically create the checkboxes on the "Select Additional Tasks" page. As you create the checkboxes programmatically, there's nothing that Tasks will give you on top of that.
If you want to use your custom checkboxes as Tasks, use Check parameter, instead of Tasks.
[Files]
Source: "MyProg.exe"; DestDir: "{app}"; Check: IsCustomTask1Selected
[Code]
var
NewCheckBox1: TNewCheckBox;
function IsCustomTask1Selected: Boolean;
begin
Result := NewCheckBox1.Checked;
end;
For a complete solution, see How to split tasklist at tasks page of Inno Setup into multiple columns?
It works with the latest version of proper Inno Setup, with no need for an obsolete custom build of Inno Setup of doubtful origin.
Side notes:
I'd recommend you to use TNewCheckListBox, instead of TNewGroupBox with individual checkboxes.
5.5.1 is very old version that suffers many security issues.
Add a method for OnClickCheck event,
procedure InitializeWizard;
begin
WizardForm.TasksList.OnClickCheck := #TasksListClickCheck
end;
Then implement TasksListClickCheck method,
procedure TasksListClickCheck(Sender: TObject);
begin
/** Do whatever you want here **/
end;
My Inno setup installer consist only on 2 custom pages.
in the first custom page show show "Abort" button and "Agree and Install" button
in the second custom page I want to replace the "Abort" button with "Decline" button,
just to change the caption of the button !
I dont know how to adress the page ID of the first and the second page so i cant make it happen.
I have seen how to create custom pages and add them to the wizard in the InitializeWizard procedure.
My problem is that when I create a custom page the default page for install location selection does not appear any more.
What options do I have to keep the default page(install location selection) and also add a my new custom page?
Code:
--------- here are my pages - -----------
procedure CreateTheWizardPages;
var
Page: TWizardPage;
Title: TNewStaticText;
Desc: TRichEditViewer;
CB_border: TPanel;
HPCB: TCheckBox;
HP_Lable:TRichEditViewer;
DSCB: TCheckBox;
DS_Lable:TRichEditViewer;
Footer: TRichEditViewer;
LinkTerms, LinkPP: TNewStaticText;
DeclineButton: TNewButton;
checkx: integer;
begin
Page := CreateCustomPage(
wpWelcome,
ExpandConstant('{cm:MainOfferPageCaption}'),
ExpandConstant('{cm:MainOfferPageDescription}'));
Page.Surface.Notebook.SetBounds(10, 70, ScaleX(WizardForm.Width), ScaleY(500));
{ Title }
Title := TNewStaticText.Create(Page);
Title.Parent := Page.Surface;
Title.Left := ScaleX(0);
Title.Top := ScaleY(0);
Title.Width := ScaleX(200);
Title.Height := ScaleY(30);
Title.Color := -16777186;
Title.Font.Name := 'Verdana';
Title.Font.Style := [fsBold];
Title.Caption := 'Wise Convert app';
Title.Font.size := 12;
Title.TabOrder := 1;
Page := CreateCustomPage(Page.ID, 'Custom wizard page controls', 'TComboBox and others');
{ Title }
Title := TNewStaticText.Create(Page);
Title.Parent := Page.Surface;
Title.Left := ScaleX(0);
Title.Top := ScaleY(0);
Title.Width := ScaleX(200);
Title.Height := ScaleY(30);
Title.Color := -16777186;
Title.Font.Name := 'Verdana';
Title.Font.Style := [fsBold];
Title.Caption := 'Wise Convert app';
Title.Font.size := 18;
Title.TabOrder := 1;
end;
------- here i change the buttons caption ----------
procedure CreateAgreeButton(ParentForm: TSetupForm; nextButton: TNewButton);
var
AgreeButton: TNewButton;
begin
WizardForm.NextButton.Caption := '&Agree and Install';
end;
procedure CreateCancelButton(ParentForm: TSetupForm; CancelButton: TNewButton);
begin
WizardForm.CancelButton.Caption := '&Abort';
WizardForm.backButton.Visible := false;
end;
I recently added different installation types (Install, Update, Repair) to my Inno Setup. It all works pretty fine.
[Types]
Name: Install; Description: "Install OLP";
Name: Update; Description: "Update an existing version of OLP";
Name: Repair; Description: "Repair OLP";
The only thing I do not like so much is the dropdown list, that appears when installation runs, to select one of the installation types.
Is there a way to replace the dropdown list by a radio group?
Thanks
You can use radio buttons (since there's no radio group component available in Inno Setup):
[Code]
procedure OnTypeChange(Sender: TObject);
begin
{ set the item index in hidden TypesCombo }
WizardForm.TypesCombo.ItemIndex := TNewRadioButton(Sender).Tag;
{ notify TypesCombo about the selection change }
WizardForm.TypesCombo.OnChange(nil);
end;
procedure InitializeWizard;
var
I: Integer;
RadioButton: TNewRadioButton;
begin
for I := 0 to WizardForm.TypesCombo.Items.Count - 1 do
begin
{ create radio button and set the basic properties }
RadioButton := TNewRadioButton.Create(WizardForm);
RadioButton.Parent := WizardForm.SelectComponentsPage;
RadioButton.Left := WizardForm.TypesCombo.Left;
RadioButton.Top := WizardForm.TypesCombo.Top + I * RadioButton.Height;
RadioButton.Width := WizardForm.TypesCombo.Width;
{ check just the first item }
RadioButton.Checked := I = 0;
RadioButton.Caption := WizardForm.TypesCombo.Items[I];
{ the Tag property substitutes the index property }
RadioButton.Tag := I;
RadioButton.TabOrder := I;
RadioButton.OnClick := #OnTypeChange;
end;
{ hide the TypesCombo combo box }
WizardForm.TypesCombo.Visible := False;
{ if you're not using the "iscustom" flag in any type entry, you can remove }
{ the following lines, because they resize and reposition the check list box }
{ for component selection, which is hidden, if you don't use "iscustom" flag }
I := WizardForm.ComponentsList.Top -
(RadioButton.Top + RadioButton.Height + 8);
WizardForm.ComponentsList.Top := RadioButton.Top + RadioButton.Height + 8;
WizardForm.ComponentsList.Height := WizardForm.ComponentsList.Height + I;
end;
And the result (includes the iscustom component list):
Or you can use e.g. check list box, which is able to contain radio buttons in Inno Setup:
[Code]
procedure OnTypeChange(Sender: TObject);
begin
{ set the item index in hidden TypesCombo }
WizardForm.TypesCombo.ItemIndex := TNewCheckListBox(Sender).ItemIndex;
{ notify TypesCombo about the selection change }
WizardForm.TypesCombo.OnChange(nil);
end;
procedure InitializeWizard;
var
I: Integer;
CheckListBox: TNewCheckListBox;
begin
{ create the TNewCheckListBox object and set the basic properties }
CheckListBox := TNewCheckListBox.Create(WizardForm);
CheckListBox.Parent := WizardForm.SelectComponentsPage;
CheckListBox.Left := WizardForm.TypesCombo.Left;
CheckListBox.Top := WizardForm.TypesCombo.Top;
CheckListBox.Width := WizardForm.TypesCombo.Width;
CheckListBox.Height := CheckListBox.MinItemHeight *
WizardForm.TypesCombo.Items.Count + 4;
CheckListBox.TabOrder := 0;
{ assign the selection change event }
CheckListBox.OnClickCheck := #OnTypeChange;
{ add radio buttons from all TypesCombo items, select the first item }
for I := 0 to WizardForm.TypesCombo.Items.Count - 1 do
CheckListBox.AddRadioButton(WizardForm.TypesCombo.Items[I],
'', 0, I = 0, True, nil);
{ hide the TypesCombo combo box }
WizardForm.TypesCombo.Visible := False;
{ if you're not using the "iscustom" flag in any type entry, you can remove }
{ the following lines, because they resize and reposition the check list box }
{ for component selection, which is hidden, if you don't use "iscustom" flag }
I := WizardForm.ComponentsList.Top -
(CheckListBox.Top + CheckListBox.Height + 8);
WizardForm.ComponentsList.Top := CheckListBox.Top +
CheckListBox.Height + 8;
WizardForm.ComponentsList.Height := WizardForm.ComponentsList.Height + I;
end;
And the result (includes the iscustom component list):
A tidy solution for this would be to use CreateInputOptionPage to create a separate page with radiobuttons prior to the component selection page. (There's an example for this in the CodeDlg.iss script.)
An even tidier option is to not ask at all, since it's entirely unnecessary. You can automatically detect the version that's already installed -- if it's not installed, it's an Install, if it's installed but older, it's an Upgrade, if it's installed and the same version, then it's a Repair, and finally if it's installed but newer then it's a Downgrade -- which you may want to either disallow (safer) or permit but display a warning (more convenient, if it's likely that people might want to downgrade).