Quote
Dave wrote in message <365CC01C.64B98...@hotmail.com>...
> Test 2 :-)
> 1) create a form and put a status bar on it. then add a panel to it and
>align it bottom. Make the panel height about 40 or so.
> 2) Now in the OnResize event for the form, put the following :
> procedure TForm1.FormResize(Sender: TObject);
> begin
> if form1.width < 300 then panel1.height := 80;
> end;
>3) start the app (panel in right spot ABOVE the status bar), and shrink the
>form down to less than 300 pixels in length, and unless I am the unluckiest
>man around, you should see the panel pop BELOW the status bar.
I have good news for you, the Delphi Gods are not picking on you. I can
reproduce this very easily. In fact, just setting the height is all it
takes, no resizing necesssary:
procedure TForm1.Button1Click(Sender: TObject);
begin
panel1.height := 80;
end;
What is apparently happening is the change in height puts the bottom of the
panel below the bottom of the statusbar and the alignment logic then orders
them accordingly. This is borne put of the following tests:
// change above line to:
panel1.height := panel1.height + statusbar1.Height;
Order is maintained correctly.
// change above line to:
panel1.height := panel1.height + statusbar1.Height + 1;
Oops, panel ends up under statusbar.
Not sure if there is any "easy" fix Inprise can do here - and, in fact,
could be argued as being "as designed" because this "feature" allows you to
*deliberately* switch positions of controls having the *same alignment
setting* simply by changing position or size.
There is an easy workaround however:
with panel1 do begin
Align := alNone;
height := 80;
Align := alBottom;
end;
This works because by turning off alignment on the panel, the statusbar is
guaranteed to maintain its bottom position (the panel will be moved above
after setting height).
--
Wayne Niddery - WinWright Consulting
Delphi, C++Builder, JBuilder, InterDev --
http://home.ican.net/~wniddery/RADBooks.html
...remove chaff when replying...
"You know you've landed gear-up when it takes full power to taxi"