I figured I'll mimic this behavior by aligning the "form" to the main form, only to find out that the windows function
GetSystemMetrics(SM_CYCAPTION) does not seem to return anything useful (0 under carbon?).
So I'm using a trick that "might" work for other platforms as well (probably not as clean as it should be, but it might be helpful to someone);
First I created a form (form2) with
borderstyle=bsNone,
FormStyle=fsSplash,
position=poDesigned - in this form a "busy" indicator.
Next I had quite a challenge determining the titlebar height of the main form (form1), but this trick seems to work ...
1) find a visible object on the main form (form1), say label1 for argument sake. Avoid objects like TPageControl, TGroupBox, etc as they can have an unexpected outcome.
2) Create an onChangeBounds event of the main form (calls this at onShow of the main form at least once to get an initial proper position):
procedure Form1.FormChangeBounds(Sender: TObject);
var myPoint:TPoint;
begin
myPoint := Label1.ClientToScreen(Point(0,0));
Form2.Top:=myPoint.Y - Label5.Top; // proper alignment, snug under the titlebar
Form2.Left:=self.Left+(self.Width DIV 2)-(Form2.width DIV 2); // center the form to the main form
end;
Now
myPoint.Y gives the absolute position of
Label1 (of Form1) on the screen, and we know the top of that object (label1), which is related to the workable area of Form1 -> we now know what Top of Form2 should be
Works like a charm ...
Edit: This doesn't look all that great in Windows though. Might need to set border style to bsSingle.