Inno Setup 函数 CheckItem 的语法和用法
Inno Setup function CheckItem syntax and usage
根据我的问题 ,我认为可能有一种方法可以让它工作,而不会在代码中设置永久检查状态的问题(尽管使用 Checked
属性) 而不是使用:
function CheckItem(const Index: Integer; const AOperation: TCheckItemOperation): Boolean;
在 TNewCheckListBox
中,但是我无法正确使用语法。我正在尝试:
CheckItem(CompIndexSync, coUncheck) := Checked[CompIndexClient];
其中 CompIndexes
是分配给组件值索引的常量。我在编译时收到标识符预期错误。有人可以建议如何正确使用此功能以及我做错了什么吗?
TNewCheckListBox
的CheckItem
成员class是一个函数类型的方法,通过AOperation
操作更新checked状态,returnsTrue如果对 Index
处的项目或其任何子项的状态进行了任何更改。这是它的原型(source
):
function TNewCheckListBox.CheckItem(const Index: Integer;
const AOperation: TCheckItemOperation): Boolean;
问题是您试图为函数结果赋值。这不是一般的 Pascal 语言可以做的。
您要对项目执行的操作由 AOperation
参数传递。在伪代码中,例如:
var
CheckList: TNewCheckListBox;
Operation: TCheckItemOperation;
begin
...
if ShouldCheck then
Operation := coCheck
else
Operation := coUncheck;
if CheckList.CheckItem(ItemIndex, Operation) then
MsgBox('An item has changed its state.', mbInformation, MB_OK);
end;
根据我的问题 Checked
属性) 而不是使用:
function CheckItem(const Index: Integer; const AOperation: TCheckItemOperation): Boolean;
在 TNewCheckListBox
中,但是我无法正确使用语法。我正在尝试:
CheckItem(CompIndexSync, coUncheck) := Checked[CompIndexClient];
其中 CompIndexes
是分配给组件值索引的常量。我在编译时收到标识符预期错误。有人可以建议如何正确使用此功能以及我做错了什么吗?
TNewCheckListBox
的CheckItem
成员class是一个函数类型的方法,通过AOperation
操作更新checked状态,returnsTrue如果对 Index
处的项目或其任何子项的状态进行了任何更改。这是它的原型(source
):
function TNewCheckListBox.CheckItem(const Index: Integer;
const AOperation: TCheckItemOperation): Boolean;
问题是您试图为函数结果赋值。这不是一般的 Pascal 语言可以做的。
您要对项目执行的操作由 AOperation
参数传递。在伪代码中,例如:
var
CheckList: TNewCheckListBox;
Operation: TCheckItemOperation;
begin
...
if ShouldCheck then
Operation := coCheck
else
Operation := coUncheck;
if CheckList.CheckItem(ItemIndex, Operation) then
MsgBox('An item has changed its state.', mbInformation, MB_OK);
end;