Windows have two sets of properties that all relate to positioning a window.
However, they are not all quite created equally.
There are, of course, the typical top, left, width and height properties. And also the “bounds” property which is a Rect.
If you examine the bounds property for a Document window, and the top, left, width and height you will find that the Bounds.top is not the same as the top property value. Nor is the height. Now why is that ?
In the following image the BOUNDS are the area enclosed by the red rectangle. And the top, left, width and height properties describe the area in light blue.
If you only had the top, left, width and height properties to use to position a window you would have to somehow figure out what the real size of the window was and account for the title bar size and possibly the outer window frame size. There may or may not be one depending on platform and window type.
And if you add a toolbar this further complicates that. The following image is the same window with a toolbar and once again marked with a red rectangle around the bounds and the blue area is the rectangle described by the top, left, width and height properties.
If, for some reason, you want to know the height of the title bar you can use the difference between the bounds top and the windows top property to see how tall it is.
Note that you cant use this difference to know how tall the title bar and toolbar independently. And toolbars dont appear to propertly report their top, left, width, or height at runtime. 🙁
Still the difference between the bounds properties and the windows other properties will let you determine how tall the title bar + any toolbar is.
Careful with those bounds out there.