Bug report: Components' Check is called before destination folder is selected

39 views
Skip to first unread message

Sergey Rozhenko

unread,
Jun 30, 2021, 8:27:53 PM6/30/21
to innosetup
I wanted to use Components for my setup instead of Tasks, but turns out there's a fatal bug with them. I need to hide some components depending on whether certain files are already installed. E.g. if nothing is installed yet there's no need to show "Check for updates" checkbox, because they's need to be installed with no choice. However, "Check" of components is called in the wrong time - before installation folder is selected instead of when the components page is about to be shown.

Gavin Lambert

unread,
Jun 30, 2021, 10:20:22 PM6/30/21
to inno...@googlegroups.com
That's by design, because all the components are populated when the
wizard is initialized.

There are some scenarios where what you describe would be more
convenient, but other scripts do assume that they can mess with the
components in InitializeWizard. It would also be a lot harder to keep
track of user component selections when going Back to or past the
component page if they can dynamically appear and disappear like that.

It's up to Jordan and Martijn whether they'd want to change this
behaviour to be more like what you're asking, of course.


In the meantime, you can accomplish something similar to what you want
by adding some code in the NextButtonClick for wpSelectDir that
manipulates the components. You can't hide components at that point,
but you can untick and disable them.

If you only want to tick/untick the components, you can use
WizardSelectComponents, which will just work.

If you want to disable the components, you'll have to edit
WizardForm.ComponentsList directly, which requires referring to the
components by index (which changes if you edit the [Components] section
or if some of them have Check functions that hide them) so you either
need to ensure none of them have Check functions and hard-code the
indexes, or search for the corresponding index by comparing the
ItemCaption -- in which case it's recommended that you use a
[CustomMessages] entry for the component descriptions to avoid typos or
translation breaking your code at a later time.

Bill Stewart

unread,
Jul 8, 2021, 1:46:42 PM7/8/21
to innosetup
On Wednesday, June 30, 2021 at 6:27:53 PM UTC-6 ser...@gmail.com wrote:
I wanted to use Components for my setup instead of Tasks, but turns out there's a fatal bug with them. I need to hide some components depending on whether certain files are already installed. E.g. if nothing is installed yet there's no need to show "Check for updates" checkbox, because they's need to be installed with no choice. However, "Check" of components is called in the wrong time - before installation folder is selected instead of when the components page is about to be shown.

If you prevent selection of components based on what's already present on the disk, how will the user perform a reinstall or upgrade?
Reply all
Reply to author
Forward
0 new messages