views:

687

answers:

2

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?

+7  A: 

TControl.BringToFront; will usually do it.

Henk Holterman
One of those "duh" moments here, apparently! Thanks!
Jamo
I was wondering if part of the question was missing or something {-:
Henk Holterman
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
You can look at their index in the Controls collection of their parent.
Paul-Jan
+4  A: 

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.

Gamecat