I have an Inno-setup script with a components page with checkboxs and a combobox. I want to unchecked and disable some components from the Code section, I used this answer to do it and I have now this code :
[Setup]
AppName=My Program
AppVersion=1.5
DefaultDirName={pf}\My Program
DefaultGroupName=My Program
UninstallDisplayIcon={app}\MyProg.exe
OutputDir=userdocs:Inno Setup Examples Output
[Types]
Name: "full"; Description: "Full installation"
Name: "compact"; Description: "Compact installation"
Name: "custom"; Description: "Custom installation"; Flags: iscustom
[Components]
Name: "program"; Description: "Program Files"; Types: full compact custom;
Name: "help"; Description: "Help File"; Types: full
Name: "readme"; Description: "Readme File"; Types: full
Name: "readme\en"; Description: "English"; Flags: exclusive
Name: "readme\de"; Description: "German"; Flags: exclusive
[code]
procedure CurPageChanged(CurPageID: Integer);
begin
if CurPageID = wpSelectComponents then
if (True) then //Here my own condition instead of "(True)"
begin
WizardForm.ComponentsList.Checked[1] := False;
WizardForm.ComponentsList.ItemEnabled[1] := False;
end;
end;
Using this, the checkbox "help" is unchecked and disabled from the code but, even if the user can't click on the "help" checkbox to check it, he can still choose "Full installation" with the combobox which change the state of the "help" checkbox from unchecked to checked (even if the checkbox stay disabled).
What I would like to do, is completely disable this component and prevent the user from selecting it (without regarding on how the user is trying do it, from clicking it or from choosing "Full installation" in the combobox).