KNOWLEDGE BASE
Log In    |    Knowledge Base    |    4D Home
Tech Tip: Programatically set the Zoom in 4D Write Pro
PRODUCT: 4D | VERSION: 16 R6 | PLATFORM: Mac & Win
Published On: July 10, 2018

In 4D Write Pro, the Zoom can be set with the contextual menu as shown below:




This also can be done with the INVOKE ACTION command. The following utility method will set the Zoom programatically:

// -----------------------------------------------------------
// Method: WP_SET_ZOOM
// Description: Method will set the Zoom in 4D Write Pro
// programatically
//
// Parameters:
// $1 (POINTER) - Pointer to 4D Write Pro object
// $2 (LONGINT) - Choice of Zoom
// 1 - 25%, 2 - 50%, 3 - 75%, 4 - 100%,
// 5 - 125%, 6 - 150%, 7 - 175%, 8 - 200%
// 9 - 300%, & 10 - 400%
// -----------------------------------------------------------
C_POINTER($1;$wpPtr)
C_LONGINT($2;$choice)
C_TEXT($invokeStr;$invokeP)

If (Count parameters=2)
  $wpPtr:=$1
  $choice:=$2
  
  $invokeStr:="zoom?value="
  
  Case of
   :(($choice>=1) & ($choice<=8))
    $invokeP:=string($choice*25)+"%"
   : ($choice=9)
    $invokeP:="300%"
   : ($choice=10)
    $invokeP:="400%"
   Else
    $invokeP:="100%"
  End case
  
   $invokeStr:=$invokeStr+$invokeP
   INVOKE ACTION($invokeStr;$wpPtr->)
End if


Example #1: 25% Zoom

WP_SET_ZOOM (->WriteproArea;1)





Example #2: 200% Zoom

WP_SET_ZOOM (->WriteproArea;8)





Example #3: 400% Zoom

WP_SET_ZOOM (->WriteproArea;10)





See Also: