hey im working on delphi 7,
and i have a scenario for a available form,
i have two forms
1. FormOne
2. FormTwo
FormOne has a button

which create the FormTwo on button click
var
Form2:TForm2;
begin
Form2:=TForm2.Create(nil);
Form2.ShowModal ;
Form2.Free;
end;
On Form2 there is a button which i need to disable..(on some conditions)..

so on activate of Form2 i did this
if assigned(Form2) then
begin
Form2.Button1.Enabled:=False;
end;
that is im checking if the form is created then disable the button..
since the code is in Onactivate meaning the form2 is already created according to this the delphi form liyfe cyle is
OnCreate -> OnShow -> OnActivate -> OnPaint -> OnResize -> OnPaint
..so the button1 should be disabled..but it NOT disabled.

I guess
Form2is a local variable in your button click handler; in yourOnActivatehandler your are testing a globalForm2variable from the unit whereTForm2is defined; the second is not assigned ifTForm2is not autocreated form.