4D v16.3Field and variable objects |
||
|
4D v16.3
Field and variable objects
Field and variable objects
In forms, fields and variables work in much the same way.
You can also represent fields and variables in your forms in alternative forms, more particularly:
You can use the Variable Type property in the "Objects" theme of the Property List to specify the data type for the variable:
Note that main purpose of this setting is to configure the themes and options available in the Property list so that they will correspond to the data type. It does not actually type the variable itself. In view of database compilation, you must use the commands of the Compiler theme. However, the Variable Type menu does have a typing function in two specific cases:
Specific native mechanisms govern the display of picture variables in forms. These mechanisms require greater precision when configuring variables: from now on, they must have already been declared before loading the form — i.e., even before the On Load form event — unlike other types of variables. To do this, you need:
Otherwise, the picture variable will not be displayed correctly (only in interpreted mode).
You can add or delete fields from a form at any time. For example, you may decide to add fields to a form when the following occurs :
To add a field to a form:
The new field appears in the form where you placed it. The field area displays the name of the field you selected, preceded by the table name. By default, 4D does not add a label to designate the field but you can create one using a static text area. Note that the label itself can be defined dynamically (see Using references in static text). After you place a field in a form, you can modify it as you would any other form object. You can resize it, change the font, choose colors for display on a color monitor, and so on. You can transform every object type (active or not) into another object type. You can also transform a field into a variable and vice-versa. This is useful when, after inserting a field in a form, you want to change that field into a variable because you don’t need to store the value. When 4D changes an object into another object, it keeps the original properties of the object (coordinates, object method, appearance, color and so on. The data type assigned to a field will be kept for the variable: a picture field will be converted to a picture variable, and so on. To change a variable into a field or a field into a variable, select the object and select Field or Variable from the Type drop-down list in the Property List (“Objects” theme). The Property List is then updated to display the properties for that new object type. The object name, object method, and its properties (size, enterable and so on) remain identical. When you change a variable into a field, 4D assigns the first field in the first table to the object by default. You can manually set the table and field in Source table and Source field (“Data Source” theme). When you associate a choice list with a field or variable, you can use the Save as Value/Reference option available in the "Data Source" theme of the Property List. This option lets you optimize the size of the data saved. For more information, refer to Save as Value or Reference.
|
PROPERTIES
Product: 4D
HISTORY
ARTICLE USAGE
4D Design Reference ( 4D v16) |