Inno Setup: WizardForm from an external form - inno-setup

I was trying to create an installer for my new project and used an external DLL to call a function to create a custom form. Instead of using the WizardForm, can I create the WizardForm from that custom form?
Here's the code I use to create that form:
procedure NewFormCreate;
var
rt: TTimer;
begin
NewForm:= TForm.Create(nil);
NewForm.BorderStyle := bsNone;
CreateFormFromImage(NewForm.Handle, 'form.png');
rt:= TTimer.create(nil);
rt.OnTimer:= #WFProc;
rt.Interval:= 1;
rt.Enabled:= true;
NewForm.Show;
NewForm.Enabled:= False;
end;

If I understand your question correctly, you want to use your own implementation of the WizardForm.
You cannot. You can only modify the existing WizardForm. Maybe like this:
CreateFormFromImage(WizardForm.Handle, 'form.png');
You can of course create and display your own form, and prevent the WizardForm from even displaying.
But it does not make sense. The Inno Setup is all about the WizardForm. If you do not want to use it, you do not need the Inno Setup at all. Build your custom installer in Delphi (if that's your preferred IDE).
Maybe you should explain us what do you really want to achieve. It's quite probable that you have an XY problem.

Is your X problem creating an installer with irregular shape?
Instead of scripting everything manually you can use Graphical Installer for Inno Setup (http://graphical-installer.com/) and achieve something like this in few minutes:
If you use Delphi you can use RAD & Installer (http://rad-installer.com/) to create the Inno Setup installers directly from RAD Studio IDE.
Sorry for little self promo :)

Related

Inno Setup - How to increase the separation between all the components of the component list?

I am using this code: Long descriptions on Inno Setup components. How to increase the separation between all the components of the component list?
Example:
And i want to see this:
There's TNewCheckListBox.MinItemHeight property that you can use to make a line in the checklist box higher, effectively increasing the spacing.
But problem is that setting the property does not affect existing items. And at the time the InitializeWizard is called, the WizardForm.ComponentsList is populated already.
What you can do is to programmatically change each item caption to trigger re-measuring of the item. Simple appending of a space will do (you can even strip it after the fact, if you wish).
procedure InitializeWizard();
var
I: Integer;
begin
{ Change line height }
WizardForm.ComponentsList.MinItemHeight := ScaleY(26);
{ Trigger re-measuring of component items }
for I := 0 to WizardForm.ComponentsList.Items.Count - 1 do
begin
WizardForm.ComponentsList.ItemCaption[I] :=
WizardForm.ComponentsList.ItemCaption[I] + ' ';
end;
end;
Or you can completely give up on the built-in components mechanism and build your own components-like page using plain checkboxes. You can layout those any way you like.
For an example of implementing a custom components page, see
Inno Setup - Create a dynamic list of components/types from external source (file or folder contents)
Or similar questions for creating custom task pages:
How to split tasklist at tasks page of Inno Setup into multiple columns?
How to build a Treeview design (a task group with tasks nesting hierarchy) using Inno Setup?

Skinned innosetup showing text instead of scrollbar

I am trying to create a new installer using InnoSetup 5.5.8 (u) and skinned using CodeJock's ISSkin v3.0.0. I am using one of the provided example skins (Office 2007 Black) applied by copying the code example from their website (http://isskin.codejock.com/gettingstarted.asp).
I am having some issues on our license agreement page. We currently show this using an RTF file in the default wizard screen. The problem is that on some machines we're getting text ('bef') showing instead of the skinned scrollbar:
The text (which is probably part of an error message) is also unreliable, as sometimes I see an unskinned, disabled scrollbar instead.
I reliably see the expected skin version on my main dev VM (Windows 8 Pro, Delphi and InnoSetup/ISSkin installed) and it's intermittent on my host machine (Win 10, no development software installed)
Has anyone encountered anything like this and got a decent fix/workaround? I have confirmed that removing the skinning code provides a working scrollbar, so that provides a workable solution for now.
This looks like a bug in skinning mechanism but the 'bef' is really weird I have never seen that. What official support says?
Maybe you could try to update/invalidate the component so the scrollbar is redrawn correctly.
Also you can try the Graphical Installer (http://www.graphical-installer.com) which is different skinning mechanism and check for this behavior there (sorry for little self promo :)
My solution for plaintext format:
procedure InitializeWizard();
var
NewLicenseMemo: TMemo;
begin
WizardForm.LicenseMemo.Visible := false;
NewLicenseMemo := TMemo.Create(WizardForm);
with NewLicenseMemo do
begin
Parent := WizardForm.LicenseMemo.Parent;
Left := WizardForm.LicenseMemo.Left;
Top := WizardForm.LicenseMemo.Top;
Width := WizardForm.LicenseMemo.Width;
Height := WizardForm.LicenseMemo.Height;
Text := WizardForm.LicenseMemo.Text;
ReadOnly := True;
ScrollBars := ssVertical;
end;
end;

Changing label texts on WizardForm page in Inno Setup

I want to change (in code) the text of certain labels on the WizardForm of the installer which are NOT exposed by the WizardForm.
Example:
ReadyLabel2a=Click Install to continue with the installation, or click Back if you want to review or change any settings.
I cannot do WizardForm.ReadyLabel2a.Caption := 'BLAH'; as the compiler complains about unknown identifier ReadyLabel2a.
Is there a way to do it?
Thanks
All components of the installer wizard form are exposed.
The label is ReadyLabel, not ReadyLabel2a. The ReadyLabel2a is ID of the message. The installer uses either message ReadyLabel2a or ReadyLabel2b for the ReadyLabel, depending on the setup configuration.
WizardForm.ReadyLabel.Caption := 'BLAH';
See TWizardForm class declaration.
You can find how the messages are used in controls in Inno Setup source code
If you need to have an installer specific texts for certain standard messages, modify the texts using Messages section:
[Messages]
ReadyLabel2a=Click Install to continue with the installation, or click Back if you want to review or change any settings.

How execute code before which the Inno Select language dialog is shown

I need to execute a pascal code before that the Select Setup language Dialog is shown , unfortunately the InitializeSetup event is executed after.
function InitializeSetup(): Boolean; //This event occurs to late
begin
DoSomething();
Result := True;
end;
So it's possible execute a script code before of the Select Setup language Dialog is shown?
I had similar problem, and I thought about different workarounds: style all setup manually, or make inner localization, but they all looked so doomed from the beginning.
Select Setup language Dialog
I have forked issrc, built it locally, and looked at the main.pas of the Setup project. I see the idea behind doing as it is now : people may wanna use {Language} in InitializeSetup, so its called after the AskForLanguage method.
To just check the idea I made small changes to main.pas: call AskForLanguage after CodeRunner inited and InitializeSetup called. I got VCL'ed Select Setup Language dialog, but not all - NON Client Area wasnt VCL'ed:
I've tried to inherit the language form not from the TForm class but from the TSetupForm, or call it in the middle of setup or make other changes - with no result. If anybody know why it's not VCL'ed - tell me please!
Then I read the Custom Window Frame Using DWM article and just made the form border bsNone and got this:
So for now I'm fine with it. That form not styled before many pages of styled setup was so... annoying.
If we wanna do it a right way, I guess all that needs to be done - is moving CodeRunner init before AskForLanguage, and add a custom code function like StyleInit or so. Then all will be happy: {Language} will be available in InitializeSetup and Dialog will be VCL'ed.
No, the function InitializeSetup() is called as first.
All other functions are called later.
Of course you can modify Inno's sources and add custom functions but I think it is not your case.
Why do you need this? Maybe there is solution which can solve your situation, please tell us details.
Another possible solution is using Inno setup Ultra, it has several inprovements, and InitializeLanguageDialog function is one of them. just load style in it. (Also you can freely change language dialog itself that is so nice).

InnoSetup pascal inheriting TControl causes identifier expected

I am trying to create my own InnoSetup Control (combined dropdown and file input box with browse button). I need dynamic number of these controls. My idea was to inherit TControl and build the needed control like that.
type
TConfigControl = class(TControl)
public
constructor Create(AOwner: TComponent);
end;
I am not avid Pascal programmer but I think the syntax should be correct. When I try to compile the InnoSetup script it gives "Identifier expected" to the second line.
On the other hand, is this the correct way to do this kind of thing in innosetup?
You can create your component in Delphi - regular Pascal allows you to do this.
Inno Setup Script cannot handle such situations (it is pretty complicated).
So develop plug-in (.dll file) and use it to place your control on Wizard's form.

Resources