main form always on bottom

This is the forum for miscellaneous technical/programming questions.

Moderator: 2ffat

Post Reply
davidlewis
Posts: 3
Joined: Wed Dec 02, 2020 8:04 am

main form always on bottom

Post by davidlewis »

I'm upgrading from a 20 year old C++ builder 5 to 10.3.3.
I find the main form is always on the bottom and moving around child forms can put them on top of each other, but main form is always on bottom.
I created a simple test with main form and 2 child forms, 2 buttons on the main form execute Form3->Show() and Form4->Show(), which works but they are always on top.
Curiously I find this behavior if I create a Windows VCL application, but not if I create a multi-device application, in which case any form can be on top.

Any thoughts?
rlebeau
BCBJ Author
BCBJ Author
Posts: 1759
Joined: Wed Jun 01, 2005 3:21 am
Location: California, USA
Contact:

Re: main form always on bottom

Post by rlebeau »

davidlewis wrote: Wed Dec 02, 2020 8:08 am I'm upgrading from a 20 year old C++ builder 5 to 10.3.3.
I find the main form is always on the bottom and moving around child forms can put them on top of each other, but main form is always on bottom.
I created a simple test with main form and 2 child forms, 2 buttons on the main form execute Form3->Show() and Form4->Show(), which works but they are always on top.
TForm Z-ordering was a real problem in early VCL versions. Because all TForm windows were owned by the hidden TApplication window [1], they would all be at the same z-order level with respect to their common owner window, allowing secondary TForms to frequently appear behind the MainForm window. Which would be especially problematic for modal TForm windows.

[1]: something made more complicated by the introduction of the TApplication::ShowMainFormOnTaskbar property in Delph/C++Builder 2007 (blog article).

This was eventually addressed in Delphi 8 [2] with the introduction of the PopupMode and PopupParent properties in TForm, and the ModalPopupMode property in TApplication. These properties affect how TForm windows are z-ordered in relation to each other, thus secondary TForm windows are now typically kept on top of the MainForm window, even on top of each other in the order they are shown (blog article).

[2]: C++Builder was End-Of-Lifed following C++Builder 6, and was not resurrected until BDS 2005.
davidlewis wrote: Wed Dec 02, 2020 8:08 am Curiously I find this behavior if I create a Windows VCL application, but not if I create a multi-device application, in which case any form can be on top.
FireMonkey handles windowing very differently than VCL does. There is no hidden TAppication window to act as a common owner for TForm windows. Each TForm is an owner-less window (well, owned by the main Desktop window, anyway), so they are free to move around each other at will (except in the case of modal windows, of course).
Last edited by rlebeau on Thu Dec 03, 2020 12:21 pm, edited 1 time in total.
Remy Lebeau (TeamB)
Lebeau Software
davidlewis
Posts: 3
Joined: Wed Dec 02, 2020 8:04 am

Re: main form always on bottom

Post by davidlewis »

Thank you very much for your help.
Post Reply