GuiClientSize - DfBaseWindow

This returns an object's client area size as a folded integer value

Type: Function

Return Data Type: Integer

Parameters: None

Return Value

A folded integer value, representing the window's client-area height (hi) and width (low) in gui units


Syntax
Function GuiClientSize Returns Integer

Call: Get GuiClientSize to IntegerVariable


Description

This returns an object's client area size as a folded value. The client-area height is returned as the Hi value and the client-area width is returned as the Low value.

This function returns a folded integer value.

When the value of the property is retrieved, the value of these two properties is returned as a folded integer. The value of these parameters can be accessed using the hi() and low() functions.

Get GuiClientSize of oView to iSize
Move (Hi(iSize))  to iY      // client area height
Move (Low(iSize)) to iX    // client area width

This can be used to programatically place child objects within container.

For example, this code can be used to place an editor within a view with a exact two dialog margin around it. This will work with any view with any style border or caption bar.

// Assume this code is within the view
// pass the child edit object to size and locate
Procedure SizeAndLocateEditor handle hoEdit
    Integer iSize iGuiSize iX iY 

    Get GuiClientSize to iGuiSize
    Move (Hi(iGuiSize))  to iY
    Move (Low(iGuiSize)) to iX

    Get GuiToDialog iY iX to iSize
    Move (Hi(iSize))  to iY // this is the Y dialog unit
    Move (Low(iSize)) to iX // this is the X dialog unit 

    Set Size of hoEdit to (iY-4) (iX-4)
    Set Location of hoEdit to 2 2
End_Procedure

This value is independent of pbSizeToClientArea. When pbSizeToClientArea is true, GuiSize will also return this value.

When sizing and locating child objects it is best to work with the client area size (GuiClientSize) instead of the outer window bounding size (GuiWindowSize)

This function can be used when an object is paged or not paged. When paged, the value is acquired from the actual window object. When not-paged, the value is calculated based on Windows system metrics. These two values should always be the same, but it is possible they will not. For example, skinning might create borders sizes that are different than the Windows system metrics. In such a case, the pre-page value of GuiClientSize may differ from the paged value. In such cases, it is always better to get the value of GuiClientSize after the window object has been paged (created).

See Also

GuiWindowSize | GuiToDialog | DialogToGui | GuiSize | pbSizeToClientArea