4D v16.3

Overview

Home

 
4D v16.3
Overview

Overview  


 

 

Forms provide the interface through which information is entered, modified, and printed. A user interacts with the data in a database using forms and prints reports using forms. In custom applications, you can use forms to create custom dialog boxes and palettes.

Each table in your database generally has at least two forms. One form is for listing records on-screen and the other form displays one record at a time and is used for data entry and modification. The form that lists records is called the output form or list form and the form that displays one record at a time is called the input form or detail form. When you are viewing records using the list form, you can double-click a record to view it using the current detail form.

In custom applications you can use the language to control which forms to use. For example, you may want to switch sets of forms depending on the type of screen used. You can also use the language to use different sets of forms for Web browsers and 4D Client users. When you write a custom application, you can create forms for use as custom dialog boxes or floating palettes. In custom applications, you can also use multiple processes to allow users to work with several forms simultaneously.

A form can display fields from more than one table. You can place fields from a related One table on a form and allow users to enter values directly into the related One table. You can also include a subform that displays a list of records from a related Many table. A subform displays a list of records from another table or a subtable in the master table. With a subform, the user can view, enter, and modify records in another table. This is sometimes known as a master-detail relationship. For example, an invoicing application would use a subform on the invoicing input form that lets the user enter line items for the invoice. Although the line items appear on the invoicing screen, the line item records are actually stored in a related Many table.

A form used for data entry can have more than one subform. For example, a contacts manager database can use one subform for telephone numbers, another subform for ToDo’s, and another for prior contacts with the person. Each subform displays records from a different related Many table.

A particular form can use some of the fields in a table or all of the fields. You might have two input forms, for example — one for use by a clerk and another for use by supervisors — neither of which contains all the fields. You might use another group of fields for the screen display and yet a fourth group for a printed report.
Forms can be modified at any time, regardless of whether you have entered data into the database. Changes to a form do not affect the data stored on disk in any way.

Each form has one or more display pages in which fields and other enterable objects appear. If your fields don’t fit on one page, you can create additional pages. When you create a multi-page form, you also add buttons or a tab control to allow users to move from one page to another.

Each form also has a background page (a page zero) on which you place objects that appear on all display pages. Use the background page to place background graphics, buttons, a tab control, and other graphic objects that define the “look” of the page, such as rectangles and labels.

Note: When a multi-page table form is used as an output form (e.g., when it is printed), only the first display page appears.

4D lets you create standard forms quickly. It also provides powerful tools that let you create forms that implement sophisticated interfaces. Your forms can provide exactly what your database needs. With only point and click operations, you can create a basic form with fields, buttons, variables, and so on.

4D has two tools for creating and modifying forms, the Form Wizard and the Form editor.

The Form Wizard is your starting place for creating any type of form. With the Form Wizard, you can create a new form by choosing the desired fields from a list and the desired form template from a drop-down list. Form templates control the appearance of forms. A template specifies such characteristics as form size, platform interface, font attributes, and buttons. For more information, refer to Creating a form using the Form Wizard.

The Form editor is an object-oriented drawing environment that lets you customize forms by manipulating objects on the form directly. For example, you can reposition objects, add objects not supported by the Form Wizard, create multi-page forms with tab controls, enforce business rules by specifying data entry constraints, specify form access privileges, associate a custom menu bar with a form, and write form and object methods that run automatically when the form is used. For more information, refer to Editing a form.

4D lets you create two categories of forms: table forms and project forms. Basically, table forms are attached to specific tables and thus benefit from automatic functions useful for developing applications based on databases. Project forms are independent forms that are not attached to any table. They are intended more particularly for creating interface dialog boxes as well as components.

Project forms can be used to create interfaces that comply with OS standards more easily. In particular, calling (via the DIALOG command) project forms that display the selections of records in subforms is now recommended by 4D for the display of records in list form. With a little additional programming, this combination is an improvement on the MODIFY SELECTION and DISPLAY SELECTION commands.

Table forms and project forms are grouped separately on the Forms Page of the Explorer.

Every form is attached to a table. Each table must usually have at least one form so that information can be entered into fields and displayed on screen. Typically, a table has separate input and output forms. The input form is the one used for data entry. It displays one record per screen and typically has buttons for saving and canceling modifications to the record and for navigating from record to record (i.e., First Record, Last Record, Previous Record, Next Record). The output form displays a list of records, with one line per record. The results of queries are shown in the output form and the user can double-click a line in an output form to display the input form for that record.

The following illustrations show a typical input and output form:

When you try to display the records of a table before creating a form for this table, 4D asks you if you want to it to create default input and output forms for you.

Note: With the Automatic Form Creation option in the Preferences, you can, for example, set 4D to automatically create default forms and therefore not display the Create Default Form dialog box. For more information, refer to the General Page.

Click Yes (or Yes for All) to create default forms. You can always return to the Design environment and modify them or replace them with more sophisticated forms. Without making any modifications, you can start using these forms to enter and display data in your database. You can also click No if you do not want to associate a form with the table. Data entry and/or display can then be carried out using project forms. Your database can use up to 32,000 forms per table, that perform specific functions.

Project forms differ from table forms in the following manner:

  • Project forms can only be of the detail (page) type. The mechanisms for output (list) forms are not compatible with project forms.
  • Project forms do not appear in the List of tables and cannot be designated as the current input or output form. They cannot be used in the Label editor nor in the 4D import/export editor (see Exporting and importing data).
  • Project forms can only be displayed using the DIALOG command or as inherited forms (see Using inherited forms).
  • Project forms can contain the same types of objects as table forms, including fields.
    When fields are used, the project form stores the number of the table and the field. When a form is copied from one database to another or within a component, the references are also copied. The table and field used are those of the target database. In the case of incompatibility (non-existent table, incorrect field type, etc.), the form will not work correctly.
    Since project forms are mainly intended to be used in the context of the DIALOG command, the buttons with standard actions for record management (Next record, Delete record, etc.) are not provided by default in the editor nor in the New Form Wizard. You must manage the display of records and any data modification therein using language commands.
    On the other hand, when project forms are used as inherited forms by the table forms, the use of automatic record management mechanisms is possible.
  • Project forms can have a form method, like table forms, which can be accessed from the Methods Page of the Explorer.

It is possible to change a table form into a project form (or to carry out the opposite transformation) at any time.
Be careful, when transforming table forms into project forms, any automatic functioning concerning data management that is present in the table form will no longer work once the form has been transformed. Similarly, a “list form” or “list form for printing” type form will be transformed into a project form of the “page” type. 

Changing the type of a form can be done by drag and drop or copy/paste on the Forms Page of the Explorer. This can be done in the same database or between two different databases. 

To transform a project form into a table form and vice versa:

  1. On the Forms page of the Explorer, click on the form that you want to transform and drop it on the destination item.
    When transforming a project form into a table form, you must drop the form onto the name of the table to which it will be attached.
    By default, the form is moved when the drag and drop operation is carried out inside the same database. If you want to copy the form, hold down the Alt (Windows) or Option (Mac OS) key during the drag and drop. When the drag and drop is between two different databases, the form can only be copied. You can also use the standard Copy/ Paste commands in the context menu of the Explorer.

 
PROPERTIES 

Product: 4D
Theme: Managing forms

 
HISTORY 

 
ARTICLE USAGE

4D Design Reference ( 4D v16)
4D Design Reference ( 4D v16.1)
4D Design Reference ( 4D v16.3)