We help IT Professionals succeed at work.
Get Started

Which Panel (TPanel) is on top?

GTwoD asked
Last Modified: 2010-04-05
Hi EE,

I have 3 objects which are Tpanel's (PanelA,PanelB and PanelC). Depending on which button the user presses I use the methods SendToBack and BringTofront to position. Is there any "simple" way I can find out which Panel is at the front? I know I could use the Visible Property, but for reasons I dont want to go into I dont.

I ideally I would like  function where I can pass a number of Tpanels and it returns a refence back to the one with the higest Z-order.


Formal Defination...
Function WhoIsOnTop(Panels:Array Of Tpanel):Tpanel;

... or Function WhoIsOnTop(Comps:Array Of TComponent):TComponent;

var ap:Tpanel;
  ap:= WhoIsOnTop([PanelA,PanelB,PanelC]);
  showmessage(ap.Name+' is on top');

As always willing to split/increase points anybody replies with a (original) sensible suggestions



Watch Question
Top Expert 2007
This problem has been solved!
Unlock 1 Answer and 4 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE