Delphi: How to programmatically adjust visual ordering of components with align = alTop

Roddy picture Roddy · Aug 11, 2009 · Viewed 24.3k times · Source

I've got a form with a number of panels, each of which has Align=alTop, so they stack down nicely from the top of the form.

However, I want to dynamically change the appearance order of these panels - i.e, move them up and down. What's the best way of doing this?

Answer

Uwe Raabe picture Uwe Raabe · Aug 11, 2009

You can easily move a top-aligned panel to the top by setting its Top property to 0. Do this in reverse requested order (bottom panel first) and you are done.