delphialignmenttpanel

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


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?


Solution

  • 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.