Solved

How can i detect that a form is al created

Posted on 1998-01-29
1
126 Views
Last Modified: 2010-04-04
In a MDI application i want to detect that a mdi child is
already created.
0
Comment
Question by:gipa
1 Comment
 
LVL 8

Accepted Solution

by:
ZifNab earned 100 total points
ID: 1357848
Iterate through the MDI childs and check the name.

To limit to only one mdi child, you can use this code
(from uddf)

 ChildIndex := 0
  while (ChildIndex < frmMDIParent.ChildCount) and
          (frmMDIParent.MDIChildren[ChildIndex].Name <> frmNewChild.Name) do
    Inc(ChildIndex);
  if ChildIndex = frmMDIParent.ChildCount then
    {create new child here}
    begin
       Create it...
       if no exception occurred, then show it...
    end
  else
    {child form already exists so just bring it to the top}
    frmMDIParent.MDIChildren[ChildIndex].BringToFront;

or maybe this

How about,



        if Form1 <> nil then
        begin
                Form1 := TForm1.Create(Application);
                Form1.Show;
        end;



Then in Form1's OnClose:



        Action := caFree;
        Form1    := nil;


0

Featured Post

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

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

Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

860 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