任务复选框实际上是WizardForm.TasksList
复选框中的项目。如果你知道它们的索引,你可以很容易地访问它们。请注意,可以对项目进行分组(这只是您的情况),并且每个新组还在该复选框中包含一个项目,因此对于您的情况,项目索引将为 1:
[Setup]
AppName=TasksList
AppVersion=1.0
DefaultDirName={pf}\TasksList
[Tasks]
Name: "TaskEntry"; Description: "Description"; GroupDescription: "Group";
[code]
function NextButtonClick(CurPageID: Integer): Boolean;
begin
Result := True;
if CurPageID = wpSelectTasks then
begin
if WizardForm.TasksList.Checked[1] then
MsgBox('First task has been checked.', mbInformation, MB_OK)
else
MsgBox('First task has NOT been checked.', mbInformation, MB_OK);
end;
end;
procedure CurPageChanged(CurPageID: Integer);
begin
if CurPageID = wpSelectTasks then
WizardForm.TasksList.Checked[1] := False;
end;
下图说明了WizardForm.TasksList
当您有两个具有不同组的任务时,检查列表框的外观:
要通过描述访问任务复选框,请尝试以下操作:
[Setup]
AppName=Task List
AppVersion=1.0
DefaultDirName={pf}\TasksList
[Tasks]
Name: "Task"; Description: "Task Description"; GroupDescription: "Group 1";
[code]
function NextButtonClick(CurPageID: Integer): Boolean;
var
Index: Integer;
begin
Result := True;
if CurPageID = wpSelectTasks then
begin
Index := WizardForm.TasksList.Items.IndexOf('Task Description');
if Index <> -1 then
begin
if WizardForm.TasksList.Checked[Index] then
MsgBox('First task has been checked.', mbInformation, MB_OK)
else
MsgBox('First task has NOT been checked.', mbInformation, MB_OK);
end;
end;
end;
procedure CurPageChanged(CurPageID: Integer);
var
Index: Integer;
begin
if CurPageID = wpSelectTasks then
begin
Index := WizardForm.TasksList.Items.IndexOf('Task Description');
if Index <> -1 then
WizardForm.TasksList.Checked[Index] := False;
end;
end;