Nico Z
Nico Z

Reputation: 1027

How to properly use duplicate functions in Inno Setup

In my code the following functions are repeated: (Because I'm using several codes to mix different functions to create my installer).

CurInstallProgressChanged

CancelButtonClick

InitializeWizard

CurPageChanged

Is it okay to rename these functions to CancelButtonClick1 and 2 (for example), etc, so as not to have errors?

Upvotes: 0

Views: 232

Answers (1)

Martin Prikryl
Martin Prikryl

Reputation: 202292

This answer is obsolete as of Inno Setup 6. For an up-to-date answer, see Merging event function (InitializeWizard) implementations from different sources.


The CurInstallProgressChanged and the CancelButtonClick1 have to have that name. You cannot name them CurInstallProgressChanged1 and the CancelButtonClick1 and expect them to be magically called.

You call the InitializeWizard1 and the InitializeWizard2 from the InitializeWizard. But you do not call the CurInstallProgressChanged1 or the CancelButtonClick1 anywhere.

If you have only one implementation of an event function, there's no need to append a number to its name. Keep the CurInstallProgressChanged and the CancelButtonClick.


Then, you have two implementations of the CurPageChanged (the CurPageChanged1 and the CurPageChanged2), but you do not have the main implementation CurPageChanged.


As the answer, I've already pointed you to says:

When you are reusing various feature implementations from different sources, those commonly implement the same Inno Setup event functions (like the InitializeWizard).

You have to merge these event functions as there can be just one function implementation.

You can do that by appending unique suffix to the different implementation and than calling them from a main implementation.

Upvotes: 2

Related Questions