The best way to do this...

I don't know if this is the best way to do this but....

Evertime a user goes through a set of steps a new panel is created on a scroll box.  I need the new panel to be aligned to TOP. However, every time I create a new one, the ones that were their first are pushed down and the new one placed above them. They are all still aligned to TOP but just backwards.  I need the most recent one on the bottom of the "stack" of TOP aligned panels.. How do I do this?


Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

hi pal,

just before you do the align be sure that the panel is positioned under (not in case of stacked)  the last panel (adjust the top/left coords and then do the aligntop)

PalamedesAuthor Commented:
Hmmm let me give that a whirl..
it works ok if you do like this:

  Form1: TForm1;
  pcap : string;
  pnum : integer;

{$R *.DFM}

procedure TForm1.Button1Click(Sender: TObject);
panel : tpanel;
pcap := 'panel';
pnum := pnum +1;
panel := tpanel.create(self);
panel.parent := scrollbox1;
panel.caption := pcap+inttostr(pnum);
panel.align := alBottom;  

{the line above stops it being on top first and the line below then moves it to next top}

panel.align := altop;;

procedure TForm1.FormCreate(Sender: TObject);
pnum := 1;

Regards Barry

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
PalamedesAuthor Commented:
Both work, but I dont want to have to keep track of the heights of the panels.. (the whole reason behind using TOP)  So, even though your answer works Kretz, I am going to give the points to inthe.  His answer works just a bit better..

Thanks to both of you.

It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.