So, I have these comtools
tasks, which, as you can see, can have a different position in the tasks list, depending on which components were previously chosen. Moreover, they may not exist at all, if the user doesn't wish to install those components.
What I need is static text shown, but only when the cursor hovers over the comtools
tasks.
[Tasks]
Name: "acorig"; Description: "ac original"; GroupDescription: "Choose which version of ac to install:"; Flags: exclusive; Components: ac
Name: "acenh"; Description: "ac enhanced"; GroupDescription: "Choose which version of ac to install:"; Flags: exclusive unchecked; Components: ac
Name: "ac2comtools"; Description: "ac2"; GroupDescription: "Also install community-made tools (unsupported) for:"; Flags: unchecked; Components: ac2
Name: "bccomtools"; Description: "bc"; GroupDescription: "Also install community-made tools (unsupported) for:"; Flags: unchecked; Components: bc
Name: "bc2comtools"; Description: "bc2"; GroupDescription: "Also install community-made tools (unsupported) for:"; Flags: unchecked; Components: bc
Name: "bc3comtools"; Description: "bc3"; GroupDescription: "Also install community-made tools (unsupported) for:"; Flags: unchecked; Components: bc3
Name: "bc4comtools"; Description: "bc4"; GroupDescription: "Also install community-made tools (unsupported) for:"; Flags: unchecked; Components: bc4
Yes, I did see https://stackoverflow.com/a/37796528/3993104, but that ties the description to index, which is not practical here. Also, that code shows description for all items in TasksList
.
Edit: So, the only change I made to the code after Martin's answer (aside from moving everything over to the tasks page) was adding Martin's function, and editing HoverComponentChanged
like this:
procedure HoverComponentChanged(Index: Integer);
var
Description: string;
begin
case Index of
-1: Description := '';
LookupTask('ac2comtools'): Description := 'This is the description of AC2';
LookupTask('bccomtools'): Description := 'This is the description of BC';
LookupTask('bc2comtools'): Description := 'This is the description of BC2';
LookupTask('bc3comtools'): Description := 'This is the description of BC3';
else
Description := '';
end;
TaskLabel.Caption := Description;
end;
-1
is a failsafe, since, when one of the components in deselected, then the index for the corresponding task is -1
, which means you will see the description for the first deselected component in this list, when your cursor is outside of TasksList
.