FB II Compiler

PG PRO

Debugging

Memory

System

Mathematics

Resources

Disk I/O

Windows

Controls

Menus

Mouse

Keyboard

Text

Fonts

Drawing

Sound

Clipboard

Printing

Communication

ASM

Made with FB

WINDOWS

Get window's dimensions


There is a convoluted and fairly awkward way to do this. The window's outside frame is stored in the window's strucRgn&. This is a region handle, expressed in global coordinates, which lives in the window record. Grab this region's bounding box and you have the window's outside dimensions.

The tricky part is going the other way. You have to build the window invisibly first, so that it has a structure region, then do this:

1) Get the new window's structure region's bounding box
2) Get the window's portRect
3) Convert the portRect into global coordinates
4) Subtract as necessary to get the width of the window's border
5) Inset the saved bounding-box frame until it sits where you want it
6) Add the border width values to the new bounding-box frame to get the new inner frame
7) Set the new inner frame as the window's contents.

Mars