4D v16Host database events |
||
|
4D v16
Host database events
Host database events
4D v14 includes new host database events that are found in the Database Events constant theme. Note: Currently, only the audio is available in English. There are new events available in the Database Events: These events can hand over control to the component we created even before the On Startup or On Exit methods are run on the database where this component is located. Let’s take a quick look at the structure. We have our database and the component folder where our component is located. We’re going to change the component to add the four events concerned. In Methods, Database Methods => On Host Database Method, we’ll copy the code shown in the documentation; this means the 4 events are visible here, and we use the method we created in the component while indicating just the event that is running. So these events can be used, for example, to initialize variables, retrieve files, check for an indicator or file, before opening, after opening, before closing or after closing, or maybe to update files for instance. Let's close the component again. Now, in the database methods for the host database, we’re going to add a couple of things: Now if we exit and launch the first database again, we can see the “on startup” event and also the “on exit” event when we close it, but there’s no trace of these events that we indicated in the component. Why not? It’s a question of security. If we want to run component events, it is mandatory to check the box allowing the On Host Database Event method of the components to be executed, found on the Security page of the Database Settings. So it is actually the host database that allows components to run the methods in question. We need to close and open the database again to see it work. So now we have the “on before startup” event of the component that runs, “on startup” of the host database, “on after host database startup” and then when we exit, “on before exit” of the component, even though it says “host database” it’s the event in question so it’s actually “on before exit” of the component, “on exit” of the host database, then “on after exit” of the component.
|
PROPERTIES
Product: 4D
HISTORY
Created: 4D v14 ARTICLE USAGE
Self-training ( 4D v16) |