KNOWLEDGE BASE
Log In    |    Knowledge Base    |    4D Home
Tech Tip: Toggling the contextual menu in View Pro
PRODUCT: 4D | VERSION: 17 | PLATFORM: Mac & Win
Published On: May 2, 2019

Here is a utility method to toggle the contextual menu in View Pro:

//---------------------------------------------------------------------------------
// Name: CONTEXT_MENU_TOGGLE_VIEWPRO
// Description: Method will toggle the contextual menu in View Pro.
//
// Parameters:
// $1 (POINTER) - View Pro object
// $2 (BOOLEAN) - True - Enable menu, False - Disable menu
// --------------------------------------------------------------------------------
C_POINTER($1;$vProObj)
C_BOOLEAN($2;$choice)
C_TEXT($jsCode_t;$res_t)

If (Count parameters=2)
  $vProObj:=$1
  $choice:=$2
  
  $jsCode_t:="spread.options.allowContextMenu="+lowercase(String($choice))+";"
  $res_t:=WA Evaluate JavaScript($vProObj->;$jsCode_t)
End if


Here is an example of disabling the contextual menu:

CONTEXT_MENU_TOGGLE_VIEWPRO (->ViewProArea;false)


When contextual clicking on a mouse, the menu does not display:




Here is an example of enabling the contextual menu:

CONTEXT_MENU_TOGGLE_VIEWPRO (->ViewProArea;true)