Solved

How can i detect that a form is al created

Posted on 1998-01-29
1
123 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

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Simple Delphi Question 9 90
Using idhttp to login to instagram 2 89
PHP preg_replace code convert to Delphi 14 56
Multi-layered image in FireMonkey 9 34
A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
This tutorial gives a high-level tour of the interface of Marketo (a marketing automation tool to help businesses track and engage prospective customers and drive them to purchase). You will see the main areas including Marketing Activities, Design …
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

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