pascalscript - Inno Setup - Pascal Script - Conditionally hide/show a task -
here's list of tasks:
[tasks] name: "d3d"; description: "install d3d engine"; groupdescription: "engines:" name: "gl"; description: "install opengl engine"; groupdescription: "engines:"; flags: unchecked name: "sw"; description: "install software engine"; groupdescription: "engines:"; flags: unchecked name: "desktopicon"; description: "{cm:createdesktopicon} launcher"; groupdescription: "{cm:additionalicons}" name: "desktopicond3d"; description: "{cm:createdesktopicon} d3d engine"; groupdescription: "{cm:additionalicons}" name: "desktopicongl"; description: "{cm:createdesktopicon} opengl engine"; groupdescription: "{cm:additionalicons}" name: "desktopiconsw"; description: "{cm:createdesktopicon} software engine"; groupdescription: "{cm:additionalicons}"
now, want achieve hiding task(s) named desktopicon{engine}
if task named {engine}
not selected.
the problem when hide 1 of tasks, index list changes, , need them reference them specifically.
i'm sure there's way solve problem indexes. didn't show code deletes tasks nor code references tasks. cannot that.
anyway, hiding tasks not common way solve this. there's built in task-hierarchy can use solve relation. or can disable tasks, instead of deleting them.
making "icon" task subtask of respective "engine" task.
[tasks] name: "desktopicon"; description: "{cm:createdesktopicon} launcher" name: "d3d"; description: "install d3d engine"; groupdescription: "engines:"; flags: checkablealone name: "d3d\desktopicon"; description: "{cm:createdesktopicon} d3d engine" name: "gl"; description: "install opengl engine"; groupdescription: "engines:"; flags: unchecked checkablealone name: "gl\desktopicon"; description: "{cm:createdesktopicon} opengl engine" name: "sw"; description: "install software engine"; groupdescription: "engines:"; flags: unchecked checkablealone name: "sw\desktopicon"; description: "{cm:createdesktopicon} software engine"
this makes inno setup automatically uncheck child "icon" task when parent "engine" task unchecked.
note checkablealone
flag in engine tasks.
disabling "icon" task if respective "engine" task unchecked.
procedure updateicontask(iconindex: integer; engineindex: integer); begin wizardform.taskslist.itemenabled[iconindex] := wizardform.taskslist.checked[engineindex]; if not wizardform.taskslist.checked[engineindex] begin wizardform.taskslist.checked[iconindex] := false; end; end; procedure updateicontasks(); begin updateicontask(6, 1); updateicontask(7, 2); updateicontask(8, 3); end; procedure taskslistclickcheck(sender: tobject); begin updateicontasks(); end; procedure initializewizard(); begin wizardform.taskslist.onclickcheck := @taskslistclickcheck; end; procedure curpagechanged(curpageid: integer); begin if curpageid = wpselecttasks begin { initial update } updateicontasks(); end; end;
Comments
Post a Comment