4D v16

コンポーネント

ホーム

 
4D v16
コンポーネント

コンポーネント    


 

 

ビデオで説明されている操作の他、以下の点にも留意してください:

4Dコンポーネントのインストールはとても簡単で、かつ大きなパワーを提供します。

コンポーネントのショートカット (エイリアス) を所定の場所に配置することもできます。これは特に同じコンポーネントを参照する複数のデータベースがあるときに便利です。ソースデータベースを変更すれば、修正がすべてのホストデータベースに反映されます。

Componentsフォルダーには複数のコンポーネントを配置することができます。

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.

 
 

 
プロパティ 

プロダクト: 4D
テーマ: コンポーネント

 
履歴 

 
ARTICLE USAGE

セルフトレーニング ( 4D v16)