WorkWidth, WorkHeight functions

Requires: GfaWinx.lg32

Purpose

Return the actual working size in pixels of a form’s workarea.

Syntax

w% = WorkWidth([form])
h% = WorkHeight([form])

form: form object
h%, w%: integer

Description

WorkWidth and WorkHeight return the actual working size in pixels of the form’s workarea (if no form is specified, then Me is assumed): the workarea is the area without the toolbar and/or statusbar, the area used by ScaleWidth and ScaleHeight.

Example

$Library "UpdateRT"

$Library "gfawinx.lg32"

UpdateRuntime      ' Patches GfaWin23.Ocx

OpenW 1 : Win_1.AutoRedraw = 1

Text 10, 10, "Overall width of Window 1:" & TwipsToPixelX(Win_1.Width)

Text 10, 25, "Internal width of work area in Window 1:" & WorkWidth(Win_1)

Text 10, 50, "Overall height of Window 1:" & TwipsToPixelX(Win_1.Height)

Text 10, 65, "Internal height of work area in Window 1:" & WorkHeight(Win_1)

Do : Sleep : Until IsNothing(Win_1)

Remarks

The same can be achieved by calculating ScaleWidth * ScaleMX and ScaleHeight * ScaleMY, but this only works for Me because ScaleMX and ScaleMY are not accessible as properties for any given form only for Me. WorkWidth and WorkHeight read their values directly from GB32’s graphical form information. Note that _X and _Y return the form’s clientsize including toolbar and/or statusbar.

See Also

WM_DPICHANGED, D2ResizeRT.

{Created by Sjouke Hamstra; Last updated: 07/03/2022 by James Gaite}