Saltar para o conteúdo principal
Versão: Próximo

VP SET ALLOWED METHODS

VP SET ALLOWED METHODS ( methodObj : Object)

ParâmetroTipoDescrição
methodObjObject->Métodos permitidos nas áreas 4D View Pro

Compatibidade

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. As soon as VP SET CUSTOM FUNCTIONS is called, VP SET ALLOWED METHODS calls are ignored. 4D View Pro also supports 4D's generic SET ALLOWED METHODS command if neither VP SET CUSTOM FUNCTIONS nor VP SET ALLOWED METHODS are called, however using the generic command is not recommended.

Descrição

The VP SET ALLOWED METHODS command designates the project methods that can be called in 4D View Pro formulas. Esse comando se aplica a todas as áreas do 4D View Pro inicializadas após sua chamada durante a sessão. Ele pode ser chamado várias vezes na mesma sessão para inicializar diferentes configurações.

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). A utilização de um método não autorizado numa fórmula imprime um error #NOME? erro na área 4D View Pro.

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:

PropriedadeTipoDescrição
<functionName>ObjectDefinição da função personalizada. The <functionName> property name defines the name of the custom function to display in 4D View Pro formulas (no spaces allowed)
methodText(obrigatório) Nome do método projeto 4D existente para permitir
parametersUma coleção de objetosColeção de parâmetros (na ordem em que são definidos no método). For more information, please refer to the Parameters section.
[ ].nameTextName of a parameter to display for the <functionName>.Note: Parameter names must not contain space characters.
[ ].typeNumberTipo do parâmetro. Supported types:
  • Is Boolean
  • Is collection
  • Is date
  • Is Integer
  • Is object
  • Is real
  • Is text
  • Is time
  • type can be omitted (except when at least one parameter is of collection type, in which case parameter's type declaration is mandatory).
    If type is omitted, by default the value is automatically sent with its type, except date or time values which are sent as an object. If type is Is object, the object is sent in a .value property. See Parameters section.
    resumoTextDescrição da função a ser exibida no 4D View Pro
    minParamsNumberNúmero mínimo de parâmetros
    maxParamsNumberNúmero máximo de parâmetros. Passar um número maior que o comprimento dos parâmetros permite declarar parâmetros "opcionais" com o tipo padrão

    Exemplo

    Pretende permitir dois métodos nas suas áreas 4D View Pro:

    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)

    Depois que esse código é executado, as funções definidas podem ser usadas nas fórmulas do 4D View Pro:

    Nas fórmulas do 4D View Pro, os nomes das funções são automaticamente exibidos em letras maiúsculas.

    Veja também

    4D functions
    VP SET CUSTOM FUNCTIONS