4D v16

Components

Home

 
4D v16
Components

Components    


 

 

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

4D components are extremely easy to install and provide added flexibility and power.

Shortcuts (aliases) can be used to point to the Component database. The main advantage of this is that you can just change the alias or modify the source database in order for all the modifications to be available in the destination database.

In your Components folder, you can install several components while keeping all these features including Windows compatibility.

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 application 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

 
HISTORY 

 
ARTICLE USAGE

Self-training ( 4D v16)