4D v14

Video script

Home

 
4D v14
Video script

Video script  


 

 

In this video, we're going to learn how to create forms.

We'll use the Form wizard to set up forms to be integrated into the navigation interface.

These forms are presented as lists as you saw in the example database at the start of this guide.

  • Display the Explorer and choose "Forms" => "Table Forms" then click on "TECHNICIANS"
  • Choose "New Form using Form Wizard" in the menu found below the list
  • Name the form: LIST
  • Choose the type: "List Form"
  • Since there are already function buttons in the navigation form, choose the "XP (no labels)" template
  • (The TECHNICIANS table is already selected)
  • In the "Available Fields" menu, choose "Related Tables" (fields are displayed in the order they were created).
  • Click on the button made up of 2 triangles to move all the fields into the "Selected Fields" list.
  • (They appear in the form that is shown in the right-hand part of the Wizard)
  • Remove any field(s) that you do not want to be shown by selecting it and then clicking on the deletion triangle.

In the Navigation form, we currently have a width of 860 pixels to display lists, so we need to control the width of the forms that we are going to create:

  • Click on the "Advanced..." button
  • Then select "Options" in the center tab.
  • Check the "Adjust Size to Fields" box and indicate a width of 860 pixels.
  • Click on OK to create the form.

4D offers to memorize the settings that we just defined in a template. A template saves all the display settings (except for fields) so as to save time when creating subsequent forms.

By using templates, you save yourself many "clicks" when setting up major development projects and also guarantee graphic consistency.

  • Click on the "Edit" button to display the form in Design mode.

You will notice that there are yellow indicators:

  • header
  • body
  • break
  • and footer

They specify the position of each form area.

  • Objects placed between the top and the header are only displayed once at the top of the form.
  • Those placed between the header and the body are displayed once for each record in the selection
  • Those placed between the break and the footer are displayed only once at the bottom of the form.
  • To temporarily hide these objects, place them beneath the footer area; in this case, they do not appear when the form is displayed.

To move control lines, simply click and drag them, but remember that an upper control line can never be moved beneath a lower one.

To move all the control lines together:

  • hold down the Shift key
  • then drag the highest control line.

This way, you maintain the same spacing between the control lines.

CTRL+Z lets you move the control lines back to their original position.

When you move control lines, if objects are also selected, they are resized as well.

To change the size of objects:

  • Select all the form objects
  • Then using each one of the lower right corners of an object, here the Technician_ID, reduce or enlarge its size
  • and all the objects nearby are automatically moved and those in the same column are resized.

Now we need to integrate this new form into the Navigation form:

  • Close the form that we just created
  • Open the "Navigation" form
  • Choose the page where we want to integrate the list of technicians (page 2 in our case). Remove the text we placed there.
  • Display the Explorer again and go to Table Forms => Technicians => then LIST
  • Click on the form name and drag it onto the "Navigation" form window. The dropped form is integrated automatically into the displayed form
  • Position the upper left corner of the dropped form below and to the right of the existing buttons.

By default, the form can be resized without constraints.

For ergonomic reasons, we recommend constraining the width and height:

So, we will:

  • Display the form properties
  • Check the box: "Automatic Width"
  • Make sure that it is "Enterable in List"
  • "Allow Deletion" of records
  • "Output subform"

We also check that:

  • the selection mode is "Multiple"
  • and that when we double-click on a line, we edit the record

When we enlarge the form, it is resized automatically according to the body size so as to display complete records.

We can test the display.

Currently, no records appear even though we have imported data into each table in previous chapters.

This is normal because we do not have any previous selections.

To select records in the Technicians table, we need to add a line of code to the "All" button in the Navigation form. So:

  • We return to page 0
  • We display the object method
  • And we request ALL RECORDS for the [TECHNICIANS] table

We'll come back to this concept of selections in more detail later on because it's an important facet of 4D.

Let's test the form again => Technicians => All: all the records now appear.

We'll proceed in the same way to integrate the list of interventions and locations into the navigation form.

When we were creating the Interventions form, remember that we had an automatic relation of the Many-to-one type in the structure; this is what is going to let us use the information of the TECHNICIANS table in the Interventions form.

We are going to transfer everything then:

  • Add the first and last name to the list
  • "Advanced" => "Options" => "Adjust Size to Fields" => 860 pixels
  • OK
  • Modify
  • Navigation form, page 1
  • Close again
  • Explorer => List of interventions
  • Close again

and here we have a form that integrates information concerning the intervention and that related to the technicians.

To execute the form, it is preferable now to do so by executing the method we created (the Navigation method) that here displays the list of interventions.

For the moment, the "All" button is programmed to display the technicians. In the next video, we're going to change it so that this "All" button adapts to whichever list you click on.

 
PROPERTIES 

Product: 4D
Theme: Output forms

 
ARTICLE USAGE

Self-training ( 4D v13)
Self-training ( 4D v14)