Solved

How can i detect that a form is al created

Posted on 1998-01-29
1
118 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
Comment Utility
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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

772 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now