Reputation: 1957
Tasks can be set to display dependent on the component selected by simply listing Components: a b c
etc and can be set to not be checked by default by specifying Flags: unchecked
. However, there doesn't appear to be a way run a conditional check using Code to have a task checked if only one specific component is selected and remaining unchecked for all others.
Name: "SystemInfo"; Description: "Audit System Information"; GroupDescription: "Additional Setup Options"; Flags: unchecked; Components: Client Standalone Server
Here I want to have the SystemInfo task display as a selectable option if the Client, Standalone or Server components are selected, but if the Server component is selected I want this option to be checked by default rather than unchecked. Basically, is there a way to do a Check: IsComponentServerSelected
in Code and remove the Flag: unchecked
if true? Maybe there is another approach to this that I have overlooked?
Upvotes: 1
Views: 3200
Reputation: 1957
I'm not entirely happy with this solution, but at least it does seem to work. It's possible to do this by creating two similar [Task]
entries and displaying either the checked or unchecked one dependent on the components selected, like so:
Name: "SystemInfo"; Description: "Audit System Information"; GroupDescription: "Additional Setup Options"; Flags: unchecked; Components: Client
Name: "SystemInfoServer"; Description: "Audit System Information"; GroupDescription: "Additional Setup Options"; Components: Server Standalone
and then in [Code]
referencing both tasks, rather than just the one:
if IsTaskSelected('SystemInfo') or IsTaskSelected('SystemInfoServer') then
begin;
AuditSystemInfo;
end;
I am still interested to hear if there is a better solution that would allow just one task to exist and to dynamically change the Flag status dependent on the components selected. Note, I did try using a Flag: {code: GetAuditFlag}
, but this did not work, I assume because it was being called too early i.e. before Setup had initialised.
Upvotes: 1