Saltar para o conteúdo principal
Versão: v20 R4 BETA

Forms

Os formulários constituem a interface através da qual a informação é introduzida, modificada e impressa numa aplicação de desktop. Users interact with the data in a database using forms and print reports using forms. Forms can be used to create custom dialog boxes, palettes, or any featured custom window.

Os formulários também podem conter outros formulários através das seguintes funcionalidades:

Criar formulários

É possível adicionar ou modificar formulários 4D usando os seguintes elementos:

  • Limits, Rulers, ...: check items that must be displayed by default in each new window of the Form editor. It is possible to modify the display of each window individually using the Display hierarchical menu of the Form editor.
  • Default display shield: sets which shields to display by default in each new window of the Form editor. For more information about shields, refer to Using shields.
  • Código JSON: Crie e conceba os seus formulários utilizando JSON e guarde os ficheiros de formulário na localização adequada. Exemplo:
{
"windowTitle": "Hello World",
"windowMinWidth": 220,
"windowMinHeight": 80,
"method": "HWexample",
"pages": [
null,
{
"objects": {
"text": {
"type": "text",
"text": "Hello World!",
"textAlign": "center",
"left": 50,
"top": 120,
"width": 120,
"height": 80
},
"image": {
"type": "picture",
"pictureFormat": "scaled",
"picture": "/RESOURCES/Images/HW.png",
"alignment":"center",
"left": 70,
"top": 20,
"width":75,
"height":75
},
"button": {
"type": "button",
"text": "OK",
"action": "Cancel",
"left": 60,
"top": 160,


"width": 100,
"height": 20
}
}
}
]
}

Formulário projeto e formulário tabela

Existem duas categorias de formulários:

  • Formulários projecto - Formulários independentes que não estão anexados a qualquer tabela. They are intended more particularly for creating interface dialog boxes as well as components. Project forms can be used to create interfaces that easily comply with OS standards.

  • Table forms - Attached to specific tables and thus benefit from automatic functions useful for developing applications based on databases. Normalmente, uma tabela tem formulários de entrada e saída separados.

Typically, you select the form category when you create the form, but you can change it afterwards.

Páginas formulário

Cada formulário é composto por, pelo menos, duas páginas:

  • uma página 1: uma página principal, exibida por defeito
  • uma página 0: uma página de fundo, cujo conteúdo é exibido em todas as outras páginas.

É possível criar várias páginas para um formulário de entrada. If you have more fields or variables than will fit on one screen, you may want to create additional pages to display them. As páginas múltiplas permitem-lhe fazer o seguinte:

  • Place the most important information on the first page and less important information on other pages.
  • Organize cada tópico na sua própria página.
  • Reduce or eliminate scrolling during data entry by setting the entry order.
  • Fornece espaço em torno dos elementos de formulário para um design de tela atrativo.

As páginas múltiplas são uma conveniência utilizada apenas para formulários de introdução. Não são para produção impressa. Quando um formulário de várias páginas é impresso, apenas a primeira página é impressa.

Não há restrições quanto ao número de páginas que um formulário pode ter. The same field can appear any number of times in a form and on as many pages as you want. However, the more pages you have in a form, the longer it will take to display it.

Um formulário de múltiplas páginas possui tanto uma página de fundo quanto várias páginas de exibição. Objects that are placed on the background page may be visible on all display pages, but can be selected and edited only on the background page. In multi-page forms, you should put your button palette on the background page. You also need to include one or more objects on the background page that provide page navigation tools for the user.

Formulários herdados

4D forms can use and be used as "inherited forms," meaning that all of the objects from Form A can be used in Form B. In this case, Form B "inherits" the objects from Form A.

References to an inherited form are always active: if an element of an inherited form is modified (button styles, for example), all forms using this element will automatically be modified.

All forms (table forms and project forms) can be designated as an inherited form. However, the elements they contain must be compatible with use in different database tables.

When a form is executed, the objects are loaded and combined in the following order:

  1. Página zero do formulário herdado
  2. Página 1 do formulário herdado
  3. Página zero do formulário aberto
  4. Página actual do formulário aberto.

This order determines the default entry order of objects in the form.

Apenas as páginas 0 e 1 de um formulário herdado podem aparecer noutros formulários.

The properties and method of a form are not considered when that form is used as an inherited form. Por outro lado, são chamados os métodos dos objetos que contém.

To define an inherited form, the Inherited Form Name and Inherited Form Table (for table form) properties must be defined in the form that will inherit something from another form.

A form can inherit from a project form, by setting the Inherited Form Table property to \<None> in the Property List (or " " in JSON).

To stop inheriting a form, select \<None> in the Property List (or " " in JSON) for the Inherited Form Name property.

It is possible to define an inherited form in a form that will eventually be used as an inherited form for a third form. A combinação de objetos é feita de forma recursiva. 4D detects recursive loops (for example, if form [table1]form1 is defined as the inherited form of [table1]form1, in other words, itself) and interrupts the form chain.

Propriedades compatíveis

Associated Menu Bar - Fixed Height - Fixed Width - Form Break - Form Detail - Form Footer - Form Header - Form Name - Form Type - Inherited Form Name - Inherited Form Table - Maximum Height - Maximum Width - Method - Minimum Height - Minimum Width - Pages - Print Settings - Published as Subform - Save Geometry - Window Title