Inno Setup: how can I resize the lower pane area? - inno-setup

How can I resize the bottom area pane of the installer?
I'd like it to be twice the height.

The lower pane are is actually an empty area. So you just need to increase the window height and decrease height of the OuterNotebook and shift up the Bevel:
[Code]
procedure IncreaseFooter(Delta: Integer);
begin
WizardForm.Height := WizardForm.Height + Delta;
WizardForm.OuterNotebook.Height := WizardForm.OuterNotebook.Height - Delta;
WizardForm.Bevel.Top := WizardForm.Bevel.Top - Delta;
end;
procedure InitializeWizard();
begin
IncreaseFooter(ScaleY(46));
end;

Related

Setting control width to half of custom page SurfaceWidth does not work correctly in Inno Setup

I placed a Panel on my custom page and gave it a width of SurfaceWidth. Then I changed its width to SurfaceWidth div 2. Here's the result:
As you can see from the screenshot the new panel's width is definitely not equal to SurfaceWidth div 2. Why is that so?
Here's the code:
[Setup]
WizardStyle=modern
[Code]
procedure InitializeWizard();
var
Page: TWizardPage;
Panel: TPanel;
begin
Page := CreateCustomPage(wpWelcome, 'Custom wizard page controls', 'TButton and others');
Panel := TPanel.Create(Page);
Panel.Width := Page.SurfaceWidth div 2;
Panel.Left := 0;
Panel.Height := 46;
Panel.Anchors := [akLeft, akTop, akRight];
Panel.Caption := 'TPanel';
Panel.Color := clWindow;
Panel.BevelKind := bkFlat;
Panel.BevelOuter := bvNone;
Panel.ParentBackground := False;
Panel.Parent := Page.Surface;
end;
That's because of the akRight in Panel.Anchors and modern WizardStyle (or rather the 120 WizardSizePercent it implies). The wizard is scaled only after the InitializeWizard. With akRight, the panel width will grow linearly (not proportionally) with the wizard. There are solutions, but they depend on how you actually want the panel to behave in the resizable wizard (also implied by the modern style).
See also Inno Setup - how to center an animated gif in resized wizard.
If you want to keep the panel at half size, when the wizard is resized (either automatically due to WizardSizePercent or by the user due to WizardResizable), handle WizardForm.OnResize:
[Code]
var
Page: TWizardPage;
Panel: TPanel;
procedure WizardFormResize(Sender: TObject);
begin
Panel.Width := Page.SurfaceWidth div 2;
end;
procedure InitializeWizard();
begin
Page := CreateCustomPage(
wpWelcome, 'Custom wizard page controls', 'TButton and others');
Panel := TPanel.Create(Page);
Panel.Width := Page.SurfaceWidth div 2;
// ...
WizardForm.OnResize := #WizardFormResize;
end;
Make sure you do not set the akRight anchor.

How can I add a image banner on the bottom left of the wizard window?

How can I add an image to the setup wizard, the bottom left?
As #TLama commented: Create a TBitmapImage, set its parent to WizardForm, position it where you want and load the picture from file.
[Files]
Source: "logo.bmp"; Flags: dontcopy
[Code]
<event('InitializeWizard')>
procedure InitializeWizardAddLogo();
var
Image: TBitmapImage;
begin
Image := TBitmapImage.Create(WizardForm);
with Image do
begin
Parent := WizardForm;
ExtractTemporaryFile('logo.bmp');
Bitmap.LoadFromFile(ExpandConstant('{tmp}')+'\logo.bmp');
AutoSize := True;
AutoSize := False;
Width := ScaleX(Width);
Height := ScaleY(Height);
Stretch := True;
Left := ScaleX(10);
Top :=
(WizardForm.ClientHeight + WizardForm.Bevel.Top +
WizardForm.Bevel.Height - Height)
div 2;
end;
end;
(the code [with event attribute] is for Inno Setup 6)
Though tricky part is to handle screen scaling correctly. Hence, the AutoSize trick and Scale* calls.
You even might need to have different versions of the logo for different scaling factors.
See Inno Setup WizardImageFile looks bad with font scaling on Windows 7

How to set WizardForm to be full screen in Inno Setup

I would like to make new installer with WizardForm.Width is width of user monitor width and WizardForm.Height is height of user monitor height.
So, I already wrote new code, but there is one error like some black area.
This is my code that I have compiled:
[Code]
function GetSystemMetrics(nIndex:Integer):Integer;
external 'GetSystemMetrics#user32.dll stdcall';
procedure InitializeWizard();
var
width,height: Integer;
begin
MainForm.BorderStyle:= bsNone;
width:= GetSystemMetrics(0);
height:= GetSystemMetrics(1);
MainForm.Width:= width;
MainForm.Height:= height;
width:= MainForm.ClientWidth;
height:= MainForm.ClientHeight;
MainForm.Left := 0;
MainForm.Top := 0;
WizardForm.Position:= poScreenCenter;
WizardForm.BorderStyle:= bsNone;
WizardForm.Width:= MainForm.Width;
WizardForm.Height:= MainForm.Height;
WizardForm.ClientWidth:= MainForm.ClientWidth;
WizardForm.ClientHeight:= MainForm.ClientHeight;
MainForm.Visible:= True;
end;
I do not understand why you engage with MainForm. Just resize the WizardForm.
[Code]
function GetSystemMetrics(nIndex: Integer): Integer;
external 'GetSystemMetrics#user32.dll stdcall';
procedure InitializeWizard();
begin
WizardForm.Position := poScreenCenter;
WizardForm.BorderStyle := bsNone;
WizardForm.Width := GetSystemMetrics(0);
WizardForm.Height := GetSystemMetrics(1);
end;
Though the wizard is not designed to be stretched over whole screen anyway.

Inno Setup Placing image/control on custom page

I'm trying to have an image on a custom page I can get the custom page to show or the image on a predefined page but not on the custom page.
Problem I think is with Parent := CustomPage.ID;.
Parent := WizardForm.SelectTasksPage; works though.
How to do this properly?
procedure ImageOnClick(Sender: TObject);
var
ErrorCode: Integer;
begin
ShellExec('', 'http://test.com', '', '', SW_SHOW, ewNoWait, ErrorCode);
end;
var
CustomPage: TWizardPage;
BtnImage: TBitmapImage;
procedure InitializeWizard;
begin
CustomPage := CreateCustomPage(wpLicense, 'Heading', 'Sub heading.');
ExtractTemporaryFile('image.bmp');
BtnImage := TBitmapImage.Create(WizardForm);
with BtnImage do
begin
Parent := CustomPage.ID;
Bitmap.LoadFromFile(ExpandConstant('{tmp}')+'\image.bmp');
AutoSize := True;
Left := 90;
Top := WizardForm.SelectTasksPage.Top +
WizardForm.SelectTasksPage.Height - Height - 8;
Cursor := crHand;
OnClick := #ImageOnClick;
end;
end;
That's what TWizardPage.Surface of type TNewNotebookPage is for.
with BtnImage do
begin
Parent := CustomPage.Surface;
{ ... }
end;
Related questions:
TInputDirWizardPage with Radio Buttons
(Similar question about radio buttons with more code)
Add additional controls to standard Inno Setup pages?
Also, never use absolute coordinates and sizes. Your layout will break, when the wizard is shown on high DPI/scaled display, what is quite common nowadays with "retina" displays. Use ScaleX and ScaleY functions. For the same reason, you should have images with different resolutions ready (see Inno Setup WizardImageFile looks bad with font scaling on Windows 7). Or at least scale/stretch the bitmap.
CustomPage := CreateCustomPage(wpLicense, 'Heading', 'Sub heading.');
ExtractTemporaryFile('image.bmp');
BtnImage := TBitmapImage.Create(WizardForm);
with BtnImage do
begin
Parent := CustomPage.Surface;
Bitmap.LoadFromFile(ExpandConstant('{tmp}')+'\image.bmp');
AutoSize := True;
AutoSize := False;
Height := ScaleY(Height);
Width := ScaleX(Width);
Stretch := True;
Left := ScaleX(90);
Top := WizardForm.SelectTasksPage.Top + WizardForm.SelectTasksPage.Height -
Height - ScaleY(8);
Cursor := crHand;
OnClick := #ImageOnClick;
end;
Layout on 100% zoom (96 DPI):
Layout on 150% zoom (144 DPI):
Layout on 150% zoom (144 DPI) with offset/sizes scaling and image stretching:
Similar to Martin Prikryl's answer.
In order to deal with different DPI settings and placing a bitmap:
setup your machine to 100% DPI
make a bitmap with size (width/height) to fit on your InnoSetup page/form
get these width and height (right click/properties on your bmp file)
use the code below
setup your machine to 150% DPI and create your bitmap to fit for 150% DPI and use it instead the first one (which fits for 100% DPI), this way it will look nice for 100% and for 200%
The code:
WarningImage := TBitmapImage.Create(RisksForm);
WarningImage.Parent := RisksForm;
WarningImage.Bitmap.LoadFromFile(ExpandConstant('{app}')+'uninstall-warning-large.bmp');
WarningImage.Left := ScaleX(24);
WarningImage.Top := ScaleY(120);
WarningImage.Width := ScaleX(544);
WarningImage.Height := ScaleY(211);
WarningImage.Stretch := True;
Change 544 with the width of your bitmap and 211 with the height of your bitmap (from step 3)
Stretch := True does the bitmap to expand (if it is smaller) or shrink (if it is bigger) than width/height properties
P.S. ofcourse you could use multiple files and use one depending on users DPI settings (DPI settings with Inno Setup), but bitmaps are without compressions, so I don't like this idea.
you can Use Botva2 library
http://krinkels.org/threads/botva2.1931/
use google translate if u can't understand rusian
u can create some awesome installer using this
image f.e
Botva2 example
[code]
#include "botva2.iss"
var SomeImage : Longint;
procedure InitializeWizard();
begin
{Your Custom page Code Goes Here}
SomeImage := ImgLoad(WizardForm.Handle,'Image.bmp',0,0,854,480,true,true)‌​;
end;
procedure CurPageChanged(CurPageID: Integer);
begin
ImgSetVisibility(SomeImage,false);
if (CurPageID = CustomPage.ID) ImgSetVisibility(SomeImage,true);
end;

Inno setup : How to set timers in between images slide show?

i Was Created one setup for slide show code is perfectly running as you given. But the images are flipping with in short span of time. So in between images i want to set timer so that i can able to see those images clearly. Is that possible ? if possible how to do please help me to do that
[code]
function InitializeSetup: Boolean;
begin
ExtractTemporaryFile('01.bmp');
ExtractTemporaryFile('02.bmp');
Result := True;
end;
procedure CurPageChanged(CurPageID: Integer);
var
BmpFile1, BmpFile2: TBitmapImage;
begin
if CurPageID = wpInstalling then begin
msgbox ('1. where are you' , mbinformation,mb_ok);
BmpFile1:= TBitmapImage.Create(WizardForm);
BmpFile1.Bitmap.LoadFromFile(ExpandConstant('{tmp}\01.bmp'));
BmpFile1.Width:= ScaleX(976);
// here you set Width (417px is Width of ProgressBar) for 1st BMP
BmpFile1.Height:= ScaleY(80);
// here you set Height for 1st BMP
BmpFile1.Stretch := True;
BmpFile1.Left := WizardForm.ProgressGauge.Left + ScaleX(0);
// here you set Left position for 1st BMP
BmpFile1.Top := WizardForm.ProgressGauge.Top + ScaleY(35);
// here you set Top posision for 1st BMP
BmpFile1.Parent:= WizardForm.InstallingPage;
BmpFile2:= TBitmapImage.Create(WizardForm);
BmpFile2.Bitmap.LoadFromFile(ExpandConstant('{tmp}\02.bmp'));
BmpFile2.Width:= ScaleX(976);
BmpFile2.Height:= ScaleY(80);
BmpFile2.Stretch := True;
BmpFile2.Left := WizardForm.ProgressGauge.Left + ScaleX(0);
BmpFile2.Top := BmpFile1.Top + BmpFile1.Height + ScaleY(8);
BmpFile2.Parent:= WizardForm.InstallingPage;
end;
end;

Resources