Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 466317
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T23:28:00+00:00 2026-05-12T23:28:00+00:00

I have created MDI application in Delphi. Lets assume that I have a bunch

  • 0

I have created MDI application in Delphi. Lets assume that I have a bunch of MDIChild forms in my application which are visible on the screen. I would like to perform a loop on those forms and check in what order each of the forms is displayed on the screen.

For example if I have 3 MDICHild forms:

FormA, FormB, FormC

and

FormB partly overlaps FormA and FormC partly overlaps FormB

I want to mark their Z property (deepth) as follows:

FormB.Z = 2 // that form is between FormA and FormC
FormA.Z = 3 // that form's distance is longest from user, form is overlapped by FormB and 
FormC.Z = 1 // that form is at the top of all forms in my application 

Thanks for your time.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-12T23:28:00+00:00Added an answer on May 12, 2026 at 11:28 pm

    J‘s answer loops through Screen.Forms. This contains all forms in the application, including non-MDI ones, as I see you found from your comment. You can filter your main form and About box manually, but that’s messy, and you’ll also need to do the same thing for other forms. I really don’t like having to do that because it seems rather error-prone.

    Your question says you only want to know the z-order of MDI child forms within the parent, and in this case there’s a much better solution.

    MDI children are listed in z-sorted order in the MDI parent form’s MDIChildren property. The code to find the Z depth would look something like this (untested):

    function FindChildDepth(Child : TForm) : Integer;
    var
      i : Integer;
    begin
      Result := -1; // Form not found
      for i := 0 to MDIChildCount-1 do
      begin
        if (MDIChildren[i] == Child) then
        begin
          Result := i;
          Exit;
        end;
      end;
    end;
    

    That should return the depth of a child between 0 and n-1, where 0 is top, and -1 if the form is not found in the MDIChildren array. If you want “1” to mean top instead of 0, simply set Result to i+1 instead.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a bunch of MDI child nodes that are all created in the
I have a Windows Forms application that opens MDI child forms. When I select
I have created an MDI application (using Qt 4.6) in Qt Creator and added
I have an MDI Application and have a sort of menu that has been
My application has many many mdi forms and they are created after successfull user
I have created alot of stored procedures in my application that return the result
I have a simple MFC MDI application, where there is main CFormView, in which
I have an MDI application in which I have a MDI child doing some
I have created a PHP-script to update a web server that is live inside
I have created a UserControl that has a ListView in it. The ListView is

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.