I'm creating an installation program using Inno Setup and I have all the custom install pages made but I need to know how to set whether or not a component will be installed. Normally there's a premade page which allows the user to select which components will get installed and which won't but I want to create a custom page with radio buttons for component1, component2 and both. I already know how to check whether a radio button is checked, I just need to know if there's any code that I can use to set the component to be installed. Too confusing?

It'd be like this:

if component1.checked = true then
component1.install = true;
else if component 2.checked = true then
component2.install = true;
end;

as the bare basics.

please

Looking for any help. I got some pretty good advice on my last Inno Setup problem here.

I don't know how you have your script set up, but the [Tasks] and [Components] sections are specifically designed for this. Every "task" you list in the tasks section indicates some component to install.

The Inno Setup Help documentation is very complete, and gives examples. You have to stare at it a little while, but it is actually pretty simple. Read the section on installation order to see where stuff fits in. Understanding that section is the key to understanding how to modify the script.

If you must do it in code, take a look through the event and support functions. (It is worth your time to read the entire Pascal Scripting section though.)

Hope this helps.

; Example
[Components]
Name: "Custom"; Description: "Custom Installation"

; Chose beetwen Applicaton 1 or 2, Components tree shows radio buttons
Name: "Custom\App1"; Description: "Application 1"; Flags: exclusive
Name: "Custom\App2"; Description: "Application 2"; Flags: exclusive

[Files]
Source: "C:\files\app1.exe"; DestDir: "{tmp}"; Components: Custom\App1
Source: "C:\files\app2.exe"; DestDir: "{tmp}"; Components: Custom\App2
....


; I have another problem, when installing multiple components, setup installer unpacks to temp and executing programs , but progress bar shows 100%, how can i solve this

Today I could use useful answer but instead of that I have to use inno setup help. Frustrating.
Answer is simple: In help is category Pascal Scripting: Support Classes reference.
Target object is TNewCheckListBox, which is named in code WizardForm.ComponentsList
For example some interesting properties in code..

WizardForm.ComponentsList.SelCount
WizardForm.ComponentsList.Checked
WizardForm.ComponentsList.ItemCaption

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.