Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

TStatusBar with bottom aligned panel

I have a form with a TStatusBar, and bottom aligned TPanel, a bottom aligned TSplitter and client aligned TPanel, as shown in the following screenshot:

Screen Shot 1 - Before - Good

(The splitter is coloured red to make it a little more obvious)

Button1 simply increases the height of Panel1 by 20:

Panel1.Height := Panel1.Height + 20;

But when clicked the order of the controls changes, with Panel1 being blow the status bar and the splitter is now resizing the status bar.

Screen Shot 2 - After - Bad

This only happens when the height of Panel1 is increased by more than the height of StatusBar1 (19).

I assume this is caused by having two bottom aligned controls, but I'm at a loss as to the exact cause of the problem and how to work around it.

I'm currently using XE2, but I have the same issue with D2010.

In this situation is there a way to set the height of Panel1 to an arbitrary value, while ensuring that the controls maintain their expected positions?

like image 343
davea Avatar asked Dec 26 '11 22:12

davea


1 Answers

Work around the problem by setting the Top property for the controls after changing the panel height.

StatusBar1.Top := Panel1.Top + Panel1.Height;
like image 167
David Heffernan Avatar answered Oct 11 '22 23:10

David Heffernan