在 Inno Setup Pascal Script 中如何确定一个对象是否已经构造?

How do you determine if an object has be constructed in Inno Setup Pascal Script?

如何检查我的复选框是否已创建/构造并可用于检查是否已选中?

[Code]

var
  MyCheckBoxThatMayExistOrNot: TNewCheckBox;

procedure Whatever();
begin
  { Check if MyCheckBoxThatMayExistOrNot exists and checked }
  if ????? and MyCheckBoxThatMayExistOrNot.Checked then
  begin
    ...
  end;
end;

TIA!!

将变量值与 nil 进行比较:

if (MyCheckBoxThatMayExistOrNot <> nil) and
   MyCheckBoxThatMayExistOrNot.Checked then

等同于使用 Assigned function:

if Assigned(MyCheckBoxThatMayExistOrNot) and
   MyCheckBoxThatMayExistOrNot.Checked then

您可能希望在 InitializeSetup or InitializeWizard, but it should not be necessary:

中将变量显式初始化为 nil