In Delphi, how do you control a visual control's z-axis position at runtime? e.g. How, programmatically and at runtime, do you accomplish the equivalent of (from the IDE main menu) "Edit -> Bring to Front" at designtime?
Asked
Active
Viewed 9,121 times
2 Answers
21
TControl.BringToFront;
will usually do it.

H H
- 263,252
- 30
- 330
- 514
-
-
-
Well, actually there is a small (much less important to the task at hand) "other half" -- on a "stack" of multiple controls, how does one determine what order they are in, without moving moving them / changing their order? – Jamo Jul 11 '09 at 08:05
-
2You can look at their index in the Controls collection of their parent. – Paul-Jan Jul 11 '09 at 08:58
11
Just to add some information.
Controls are created in order (in the dfm file). The last control overlaps the first if they share part of the window. You can change the order by changing the order of the controls in the dfm file.
At runtime, you can change the order in the control list. But BringToFront will do this for you.

Toon Krijthe
- 52,876
- 38
- 145
- 202