How to use Assigned as a check for a dynamicly created form.
Posted on 2003-11-03
On my mainform I have a button to create another form as below
procedure TfrmMain.btn_NewfrmClick(Sender: TObject);
if not Assigned(myform) then
myform := TmyForm.Create(frmMain);
myform.FormStyle := fsStayOnTop;
The new myform is created fine.
The OnClose of myForm contains:
procedure TmyForm.FormClose(Sender: TObject; var Action: TCloseAction);
Action := caFree;
myForm := nil;
My question is: If I try to open the form a second time then I cannot.
It appears that the call (myForm := nil) in myForm doesn't actually set
myForm to nil;
Any help would be most appreciated.