4D v14.3List subforms |
||
|
4D v14.3
List subforms
List subforms
A subform is a form from another table that is displayed in a Detail form. A list subform lets you enter, view, and modify data in other tables. You usually use list subforms in databases in which you have established One to Many relations. A list subform on a form in a related One table lets you view, enter, and modify data in a related Many table. You can have several subforms coming from different tables in the same form. However, it is not possible to place two subforms that belong to the same table on the same page of a form. For example, a Contacts manager database might use a list subform to display all the telephone numbers for a particular contact. Although the telephone numbers appear on the Contacts screen, the information is actually stored in a related table. Using a One to Many relation, this database design makes it easy to store an unlimited number of telephone numbers per contact. With automatic relations, you can support data entry directly into the related Many table without programming. Although list subforms are generally associated with Many tables, a subform instance can display the records of any other database table. You can create a list subform using the Form Wizard or by adding an existing form using the Form editor. You must create the List form that you want to use as the subform. List subforms can be used for data entry in two ways: the user can enter data directly in the subform, or enter it in an input form. In this configuration, the form used as the subform is referred to as the List form. The input form is referred to as the Detail form. ------> You can also allow the user to enter data in the List form: To define a list form, you must first Create and configure the subform that you want to use in the parent form. For more information about list forms, refer to the chapter Output forms and reports. In the parent form, create a subform object using the Subform tool of the object bar (variation of the last button). Note: You can also perform a drag-and-drop operation from the Forms Page of the Explorer. In the Property List (“Sub-Form” theme), make sure that the Output subform option is checked and choose the source table in the Source menu as well as the List Form that you want to use. In the parent form, you can resize and reposition the subform container as desired. You can specify several specific properties for list subforms. You use these properties to control various automatic features and allowed user actions (selection and data entry modes). You normally use these properties for page subforms. Refer to Page subforms. You use this property to specify the type of source for the subform. For list subforms, choose the table that the subform belongs to. You use this option to associate a detail form with a list subform. A detail form can be used to enter or view subrecords. It generally contains more information than the list subform. Naturally, the detail form must belong to the same table as the subform. You normally use an Output form as the list form and an Input form as the detail form. If you do not specify the form to use for full page entry, 4D automatically uses the default Input format of the table. Depending on the configuration of the subform, the user may display the detail form by double-clicking on a subrecord or by using the commands for adding and editing subrecords. Note: You can associate a detail form with a list subform by holding down Shift and dragging the detail form from the Explorer onto the subform cpntainer. You can resize the subform area in the form as desired, just like any other form object. Note: When you create a subform area by dragging a form directly from the Explorer, 4D automatically sets the width of the subform. List subforms can have three user selection modes: None, Single and Multiple.
When a list subform is Enterable in List, the user can modify record data directly in the list, without having to use the associated detail form. To do this, simply click twice on the field to be modified in order to switch it to editing mode (make sure to leave enough time between the two clicks so as not to generate a double-click). By default, this mode is activated for all list subforms: When this option is not checked, entry must be carried out via the associated detail form. You can set parameters for how a list subform should behave in response to a user double-click. In databases created with a previous version of 4D, you can also set the response to a double-click on an empty line (compatibility option).
By default, the user can delete subrecords in a list subform using the Del or Backspace keys. Since this could disturb the standard operation of the interface for certain applications (based, for instance, on buttons), you can prevent it using the Allow Deletion option. When this option is not checked, the user can no longer delete subrecords using the deletion keys of the keyboard. The subform instance can have the Focusable property (“Entry” theme). When a subform instance has the focus, the user can control it using navigation keys, using the Select All menu command (if the selection has multiple lines), etc. When a subform receives or loses the focus, the form method of the parent form is called using the On getting focus or On losing focus events. In this case, the OBJECT Get pointer command (or the Focus object command) returns a pointer to the table of the subform. As with all focusable objects, you can use the Hide focus rectangle property when you do not want to show the focus graphically . Since there may be several records that the subform area cannot hold, 4D offer three options (“Print” theme) to handle the printing of subform records:
You can add custom buttons for handling data entry in a subform. Any kind of button — standard, highlight or invisible — can be used. You can set the action of these buttons using programming (see Data Entry) or using Standard actions. 4D offers three standard actions to meet the basic needs for managing subrecords: Edit Subrecord, Delete Subrecord, and Add Subrecord. When the form includes several subform instances, the action will apply to the subform that has the focus. For more information about adding these buttons and their associated standard actions, refer to Buttons and Standard actions. |
PROPERTIES
Product: 4D SEE ALSO ARTICLE USAGE
4D Design Reference ( 4D v14 R2) Inherited from : List subforms ( 4D v12.4) |