[Worked around] Set a TPanel Z Order to a specific value lazarus / 31-LCL ---------------------------------------------------------------------- Mike.Cornflake · 2014-09-21 14:23 I know the long way to change a panel's z-order to what I want.  Enumerate over all controls, calling SendToBack or BringToFront in just the right order.   But that's messy, and today I'm chasing elegant (Sunday best and all that) :-) Is there a simple way of setting the Z-Order of a TPanel so it's directly above another TPanel without mucking around with every other related visible control?  (Both Panels have the same parent - oh - it's another Panel, let call it PanelParent :-) ) I've got this far on my own, and yeah, it's working.   But my problem is I don't know how to retrieve the current Z-Order of Panel1... Code: [Select]Type   THackPanel = Class(TPanel)   end; procedure TForm1.Button2Click(Sender: TObject); begin   THackPanel(PanelParent).SetChildZPosition(Panel2, 0);   //THackPanel(PanelParent).SetChildZPosition(Panel2, Panel1.ZOrder+1);  // <-- What I want... end; Alternatively, is there just a better way of doing this? ---------------------------------------------------------------------- Mike.Cornflake · 2014-09-21 14:49 Actually - ignore this.  I've found a solution using BringToFront thats easy to read and works....  (not worth posting - relates to the classes in use)