Tech Tip: Programmatically Determine Form Dimensions
PRODUCT: 4D | VERSION: 13.3 | PLATFORM: Mac & Win
Published On: December 6, 2013
Here is a utility method to programmatically determine a form's dimensions.
The method will find the current width and height of a form, depending on what was passed into the first parameter(“width” or “height”). This may be useful to call on the form event On Resize to dynamically determine the form width and/or height.
// Method: GET_FORM_DIMENSIONS // Parameters // $1 - "width" or "height" // $2 - window reference number (optional) // // Return // $0 - current width or height of a form // ---------------------------------------------------- C_LONGINT($0) C_TEXT($1;$mode) C_LONGINT($2;$winref) C_LONGINT($left;$top;$right;$bottom) $mode:=$1 If (Count parameters>1) $winref:=$2 Else $winref:=Current form window End if GET WINDOW RECT($left;$top;$right;$bottom;$winref) Case of :($mode="width") $0:=$right-$left : ($mode="height") $0:=$bottom-$top End case |
See Also: