Tech Tip: Resizing an object based on its contents
PRODUCT: 4D | VERSION: 2004 | PLATFORM: Mac & Win
Published On: December 9, 2004
Version 2003 & 2004
Here is a generic project method that will resize an object to display its entire contents:
` Project Method: ResizeObjectToBestSize
` $1 - Name of the object to be resized
C_LONGINT($left;$top;$right;$bottom;$bestWidth;$bestHeight;$resizeW;$resizeH)
C_TEXT($1;$objname)
$objname:=$1
GET OBJECT RECT(*;$objname;$left;$top;$right;$bottom)
BEST OBJECT SIZE(*;$objname;$bestWidth;$bestHeight)
$resizeW:=$bestWidth-($right-$left)
$resizeH:=$bestHeight-($bottom-$top)
MOVE OBJECT(*;$objname;0;0;$resizeW;$resizeH)