4D v16

Form inheritance

Home

 
4D v16
Form inheritance

Form inheritance    


 

 

In addition to the manipulations explained in the video, you should also note that:

  • Theoretically, there is no limit for inheritance; a form can be inherited from another form that is itself inherited from yet another form, and so on.
  • A parent form is a full-fledged form. It can consist of several pages including a page 0. Within the framework of inheritance, only pages 0 and 1 of the parent form are visible on child forms.

Create at least one inherited form:

  • for your list forms
  • another for input forms
  • and a last one for information or settings forms.

In certain cases, you may need for a parent form object to be hidden or only available according to the context or the table concerned.

  • In the case of a button, you can disable it using the DISABLE BUTTON command
  • If you want to hide an object, you can use the OBJECT SET VISIBLE command
  • You can also use the OBJECT MOVE command

In this video, well set up forms so that we can have a consistent interface, stored at a single place per form category.

We have already used page 0 in forms in order to centralize elements that are shared on every page of the same form.

Form inheritance consists of creating a form where we place objects that are shared between several forms (texts, buttons, etc.) that will inherit from this "parent" form.

In order, we need to:

  • create a "parent" form
  • place the objects on it
  • and indicate the "relationship" with the "child" forms that will inherit from it.

The parent form can be a project form or a form associated with a table.

Here we're gong to create this new form.

  • In the Explorer choose => "Project Forms"
  • Click on +
  • Call it HERIT_PAGE since we're going to create a form intended to be inherited on different pages.
    A blank form appears.
  • We add a button at the top left.
  • And Save the form.

Now that the parent exists, we can associate child forms with it:

  • Open the input form for interventions
  • and in the Property list of the form
  • we're going to choose "Inherited page" as the Inherited form.

We can see the contents of the parent form immediately appear in the background.

If we modify the location of the button on the parent form and save it (without closing it), we'll see the same modification carried out directly on the child form.
And of course it is also carried out on forms that are closed.

Since the goal is to keep the interface consistent, we're going to move the buttons of the child form to the parent form.

  • Cut
  • Paste
  • and Save

and the buttons appear again automatically in the child form.

Now, to apply this modification to other input forms, you just need to:

  • Open them (Technician => Input)
  • Remove the buttons already included in the form
  • Then set the Inherited Form Name to "HERIT_PAGE"

This means that now any changes made to the parent form, for instance if we move everything just a few pixels and then save it, will be automatically carried out on all the forms that inherit from this parent form.

 
 

 
PROPERTIES 

Product: 4D
Theme: Form inheritance

 
HISTORY 

 
ARTICLE USAGE

Self-training ( 4D v16)