Reputation: 2271
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!!
Upvotes: 1
Views: 450
Reputation: 202118
Compare the variable value against nil
:
if (MyCheckBoxThatMayExistOrNot <> nil) and
MyCheckBoxThatMayExistOrNot.Checked then
An equivalent is use of Assigned
function:
if Assigned(MyCheckBoxThatMayExistOrNot) and
MyCheckBoxThatMayExistOrNot.Checked then
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?
Upvotes: 1