version 2004
In 4th Dimension 2004, developers can offer users the possibility of creating or modifying customized forms. These "User forms" can then be used like any other 4th Dimension form.
Introduction
User forms are based on standard 4th Dimension forms created by the developer in the Design environment (called "source" or "developer" forms) where the Editable by user property has been applied in the Form editor. A simplified Form editor (called using the EDIT FORM command) allows users to modify the form appearance, add graphic objects (using a library of specific objects), hide elements, etc. the developer can control of authorized actions.
User forms can be used in two different ways:
The user modifies the "source" form and adapts it to his or her needs using the EDIT FORM command. The user form is kept locally and is automatically used instead of the original form.
This behavior responds to a developer's need to set parameters for dialog boxes while on site; for example, to add a company logo in forms, hide unnecessary fields, etc.
The "source" file acts as a basic template that users can freely duplicate and make as many copies as necessary using the CREATE USER FORM command. Each copy can be set freely (content, name, etc.) using the EDIT FORM command. However, the name of each user form must be unique. The INPUT FORM and OUTPUT FORM commands then let you specify the user form to be used in each process.
This behavior lets developers build, for example, customized reports for users.
Storing and managing user forms
User form mechanisms work with both compiled and interpreted databases, with 4th Dimension, 4D Server, 4D Runtime, ou 4D Runtime. In client/server mode, user modified forms are available on all machines.
4D automatically handles changes in forms. When a form is set as Editable by user, it is locked in the Design environment. The developer must explicitly click on the icon to unlock it in order to be able to access form objects. This operation makes related user forms obsolete, which must also be regenerated. When a "source" form is deleted, the related user forms are also deleted.
User forms are stored in a separate file with a .4DA extension, placed next to the main structure file (.4DB/.4DC). This file is called "user structure file". The behavior of this file is transparent: 4th Dimension uses a user form when it exists (the new LIST USER FORMS command allows finding valid user forms at any time). It is also in this file that the INPUT FORM and OUTPUT FORM commands look for the user forms. When a user form is obsolete, it is deleted and 4th Dimension uses the source form by default.
In client/server, the .4DA file is broadcast on client machines following the same rules as the main structure file.
This principle also allows keeping user forms non-obsolete in case of a structure file update by the developer.
Error codes
Specific error codes may be returned when using user form management commands. These codes, located from -9750 to -9759, are described in the Database Engine Errors section.