We help IT Professionals succeed at work.
Get Started

Which Panel (TPanel) is on top?

GTwoD
GTwoD asked
on
557 Views
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.

e.g.

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

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


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

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

Cheers

G2d




Comment
Watch Question
Top Expert 2007
Commented:
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