Solved

How to use Assigned as a check for a dynamicly created form.

Posted on 2003-11-03
1
169 Views
Last Modified: 2012-05-04
On my mainform I have a button to create another form as below

procedure TfrmMain.btn_NewfrmClick(Sender: TObject);
begin
  if not Assigned(myform) then
    begin
      myform := TmyForm.Create(frmMain);
      myform.FormStyle := fsStayOnTop;
      myform.Show;
    end;
end;

The new myform is created fine.

The OnClose of myForm contains:

procedure TmyForm.FormClose(Sender: TObject; var Action: TCloseAction);
begin
  Action := caFree;
  myForm := nil;
end;

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.
-Rick
0
Comment
Question by:rickluttrell
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 4

Accepted Solution

by:
brunomsilva earned 250 total points
ID: 9672704
where do you have the myform variable defined? place it before the implementation section of the mainform.
It works with me.

Bye,
 Bruno
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…

737 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question