KNOWLEDGE BASE
Log In    |    Knowledge Base    |    4D Home
Tech Tip: Setting the Zoom in View Pro
PRODUCT: 4D | VERSION: 17 R | PLATFORM: Mac & Win
Published On: March 20, 2019
Your current browser may not allow you to download the asset. We recommend Mozilla Firefox or Google Chrome.
Log In

Here is a utility method to set the zoom view of 4D View Pro programatically:

//---------------------------------------------------------------------------------
// Name: SET_ZOOM_VIEWPRO
// Description: Method will set the zoom in View Pro.
//
// Parameters:
// $1 (POINTER) - View Pro object
// $2 (LONGINT) - Zoom 0 (smallest) - 4 (largest)
// --------------------------------------------------------------------------------
C_POINTER($1;$vProObj)
C_LONGINT($2;$size)
C_TEXT($jsCode_t;$res_t)

If (Count parameters=2)
  $vProObj:=$1
  $size:=$2
  
  $jsCode_t:="spread.allowUserZoom=false;"+Char(Carriage return)+Char(Line feed)
  $jsCode_t:=$jsCode_t+"spread.getActiveSheet().zoom("+string($size)+");"
  $res_t:=WA Evaluate JavaScript($vProObj->;$jsCode_t)
End if


1. Here is the Zoom setting at 0 (smallest):

SET_ZOOM_VIEWPRO(->ViewProArea;0)




2. Here is the Zoom setting at 1:

SET_ZOOM_VIEWPRO(->ViewProArea;1)




3. Here is the Zoom setting at 2:

SET_ZOOM_VIEWPRO(->ViewProArea;2)




4. Here is the Zoom setting at 3:

SET_ZOOM_VIEWPRO(->ViewProArea;3)




5. Here is the Zoom setting at 4 (largest):

SET_ZOOM_VIEWPRO(->ViewProArea;4)