4D v14

Video script

Home

 
4D v14
Video script

Video script  


 

 

Now we're going to learn create a component.

A component is a separate 4D database that is integrated into a host database, which then has access to the methods and forms available in this component.

We're going to:

  • Quit 4D
  • Start it again
  • Create a new applicaton that we'll call Component_v13

and in this new application:

  • We're going to create a project method
  • that we'll call ALERT
  • and whose code will be this:
    • It receives 2 parameters
    • and depending on the number of parameters received
    • it assigns values to 2 variables that are used in the ALERT command.

Then in the information about the method we specify that this method is shared between the component and the host database and then exit the database.

In our database:

  • We create a Components folder
  • We drop our component in it
  • And restart.

In the list of methods, we can see the component methods including "Component v13" that we just created with the ALERT method.

We can substitute this ALERT command for all other calls to the 4D ALERT command.

To do this, we just need to replace 1 character. Of course, we could do it using "Replace in the contents".

Once these changes are made, we can test them, for example, using the Test_Variables form where we have, on the calculation here, the ALERT command that is going to be executed, and here we are on the component method.

We can check it by passing a 2nd parameter: it still works, we get the text passed as a parameter.

Our component is working properly and we can add as many methods to it as we like.

 
PROPERTIES 

Product: 4D
Theme: Components

 
ARTICLE USAGE

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