您如何确定是否已在Inno Setup Pascal脚本中构造了对象? [英] How do you determine if an object has be constructed in Inno Setup Pascal Script?

查看:35
本文介绍了您如何确定是否已在Inno Setup Pascal脚本中构造了对象?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

How do I check that my checkbox has been created / constructed and can be used to check if checked?

[Code]

var
  MyCheckBoxThatMayExistOrNot: TNewCheckBox;

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

TIA !!

推荐答案

将变量值与 nil进行比较 :

Compare the variable value against nil:

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

等效使用 Assigned 函数:

An equivalent is use of Assigned function:

if Assigned(MyCheckBoxThatMayExistOrNot) and MyCheckBoxThatMayExistOrNot.Checked then


您可能想在nil ."nofollow noreferrer"> InitializeSetup Pascal脚本中的全局变量是否为零-初始化了吗?


You might want to explicitly initialize the variable to nil in InitializeSetup or InitializeWizard, but it should not be necessary: Are global variables in Pascal Script zero-initialized?

这篇关于您如何确定是否已在Inno Setup Pascal脚本中构造了对象?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆