This is the legacy 4D documentation web site. Documentations are progressively being moved to developer.4d.com

Home

 
4D v19
VP SET ALLOWED METHODS

VP SET ALLOWED METHODS 


 

VP SET ALLOWED METHODS ( methodObj ) 
Parameter Type   Description
methodObj  Object in Allowed methods in the 4D View Pro areas

The VP SET ALLOWED METHODS command designates the project methods that can be called in 4D View Pro formulas. This command applies to all 4D View Pro areas initialized after its call during the session. It can be called multiple times in the same session to initialize different configurations. 

By default for security reasons, if you do not execute the VP SET ALLOWED METHODS command, no method call is allowed in 4D View Pro areas -- except if 4D's generic SET ALLOWED METHODS command was used (see compatibility note). Using an unauthorized method in a formula prints a #NAME? error in the 4D View Pro area. 

Compatibility Note: 4D View Pro supports 4D's generic SET ALLOWED METHODS command if VP SET ALLOWED METHODS is not called, however using VP SET ALLOWED METHODS is recommended. As soon as it has been called, the SET ALLOWED METHODS command no longer has an effect on any 4D View Pro areas. 

In the methodObj parameter, pass an object in which each property is the name of a function to define in the 4D View Pro areas:

PropertyTypeDescription
<functionName>ObjectName of the custom function to display in 4D View Pro formulas (no spaces allowed)
methodtext(mandatory) Name of the existing 4D project method to allow
parametersCollection of objectsCollection of parameters (in the order they are defined in the method). 
[ ].nameTextName of a parameter to display for the <functionName>. Note: Parameter names must not contain space characters.
[ ].typeNumberType of the parameter. Supported types:
Constant
Is Boolean
Is date
Is longint
Is object
Is real
Is text
Is time
If omitted, by default the value is automatically sent with its type, except date or time values which are sent as an object (see Parameters section). If type is Is object, the object has the same structure as the object returned by VP Get value.
summaryTextFunction description to display in 4D View Pro
minParamsNumberMinimum number of parameters
maxParamsNumberMaximum number of parameters. Passing a number higher than the length of parameters allows declaring "optional" parameters with default type
 

For greater flexiblity, it is recommended to use the VP SET CUSTOM FUNCTIONS command which allows you to designate 4D formulas that can be called from 4D View Pro areas.

Example  

You want to allow two methods in your 4D View Pro areas:

 C_OBJECT($allowed)
 $allowed:=New object //parameter for the command
 
 $allowed.Hello:=New object //create a first simple function named "Hello"
 $allowed.Hello.method:="My_Hello_Method" //sets the 4D method
 $allowed.Hello.summary:="Hello prints hello world"
 
 $allowed.Byebye:=New object //create a second function with parameters named "Byebye"
 $allowed.Byebye.method:="My_ByeBye_Method"
 $allowed.Byebye.parameters:=New collection
 $allowed.Byebye.parameters.push(New object("name";"Message";"type";Is text))
 $allowed.Byebye.parameters.push(New object("name";"Date";"type";Is date))
 $allowed.Byebye.parameters.push(New object("name";"Time";"type";Is time))
 $allowed.Byebye.summary:="Byebye prints a custom timestamp"
 $allowed.Byebye.minParams:=3
 $allowed.Byebye.maxParams:=3
 
 VP SET ALLOWED METHODS($allowed)

After this code is executed, the defined functions can be used in 4D View Pro formulas:

Note: 4D View Pro function names are automatically displayed in uppercase. 



See also 

Project method references
VP SET CUSTOM FUNCTIONS

 
PROPERTIES 

Product: 4D
Theme: 4D View Pro Language
Number: 9777

 
PAGE CONTENTS 
 
HISTORY 

Created: 4D v17 R6

 
ARTICLE USAGE

4D View Pro Reference ( 4D v19)