KNOWLEDGE BASE
Log In    |    Knowledge Base    |    4D Home
Tech Tip: A utility method to get an image of a loaded form object
PRODUCT: 4D | VERSION: 20 | PLATFORM: Mac & Win
Published On: May 28, 2024

The followiing method return an image of a form object tin the form that is currently loaded.

 // Method: formObjectToImage
#DECLARE($objName_t : Text)->$obj_m : Picture
If (Count parameters=1)
  var $l; $t; $r; $b : Integer
  OBJECT GET COORDINATES(*; $objName_t; $l; $t; $r; $b)
  FORM SCREENSHOT($obj_m)
  TRANSFORM PICTURE($obj_m; Crop; $l; $t; $r-$l+1; $b-$t+1)
End if


Example:

$picture:=formObjectToImage("Button3")

$picture:=formObjectToImage("List Box")

Commented by Jody Bevan on June 6, 2024 at 9:09 AM
I think there is a slight typo: ... an image of a form object >tin< the form that is....