Saltar al contenido principal
Versión: 20 R9

Formulario

Form : Object

ParámetrosTipoDescripción
ResultadoObjectDatos del formulario actual
Historia
LanzamientoModificaciones
20 R8Soporte de las clases de formularios

Descripción

El comando Form devuelve el objeto asociado al formulario actual (instanciado a partir del parámetro formData o de la clase de usuario asignada en el editor de formularios). 4D automatically associates an object to the current form in the following cases:

  • the current form has been loaded by one of the DIALOG, Print form, or FORM LOAD commands,
  • el formulario actual es un subformulario,
  • un formulario de tabla se muestra actualmente en la pantalla.

Commands (DIALOG...)

If the current form is being displayed or loaded by a call to the DIALOG, Print form, or FORM LOAD commands, Form returns either:

Subformulario

If the current form is a subform, the returned object depends on the parent container variable:

  • Form returns the object associated with the table form displayed on screen.
    Form returns the object associated with the table form displayed on screen.
    In the context of an input form displayed from an output form (i.e. after a double-click on a record), the returned object contains the following property:
 (OBJECT Get pointer(Object subform container))->  
  • If the variable associated to the parent container has not been typed as an object, Form returns an empty object, maintained by 4D in the subform context.

Para más información, consulte la sección Subformularios de página.

Formulario tabla

Form returns the object associated with the table form displayed on screen.
Form returns the object associated with the table form displayed on screen.
In the context of an input form displayed from an output form (i.e. after a double-click on a record), the returned object contains the following property: Form returns the object associated with the table form displayed on screen.
In the context of an input form displayed from an output form (i.e. after a double-click on a record), the returned object contains the following property:

PropiedadTipoDescription
parentFormobjectObjeto Form del formulario de salida padre

Ejemplo

En un formulario que muestra el registro de una persona, un botón "Check children" abre un cuadro de diálogo para verificar/modificar los nombres y edades de sus hijos:

Nota: el campo objeto "Children" se representa sólo para mostrar su estructura en este ejemplo.

In the verification form, you have assigned some Form object properties to inputs:

Este es el código del botón "Check children":

 var $win;$n;$i : Integer
var $save : Boolean
ARRAY OBJECT($children;0)
OB GET ARRAY([Person]Children; "children";$children) //obtener la colección children
$save:=False //inicializar la variable save

$n:=Tamaño del array($children)
If($n>0)
$win:=Open form window("Edit_Children";Movable form dialog box)
SET WINDOW TITLE("Check children for "+[Person]Name)
For($i;1;$n) //para cada hijo
DIALOG("Edit_Children";$children{$i}) //muestra el diálogo lleno de valores
If(OK=1) //el usuario ha pulsado OK
$save:=True
End if
End for
If($save=True)
[Person]Children:=[Person]Children //forza la actualización del campo objeto
End if
CLOSE WINDOW($win)
Else
ALERT("No child to check.")
End if

El formulario muestra información sobre cada niño:

Si se editan los valores y se presiona el botón OK, se actualiza el campo (después hay que guardar el registro principal).

Ver también

DIALOG

Propiedades

Número de comando1466
Hilo seguro