|
|
|
|
|
Events associated with the project
WINDEV, WEBDEV and WINDEV Mobile handle the following events by default (order of appearance in the code editor): | | Event | Runtime condition |
---|
Initialization | Executed when the application is started. Here is the order in which the events are run when starting an application (also when running a test):- Initialization of the components "loaded when starting the application".
- Initialization of sub-components(*).
- Initialization of component classes.
- Initialization of the sets of procedures of the component.
- Initialization of the component project(*).
- Initialization of classes.
- Initialization of sets of procedures.
- Initialization of the project.
- Initialization of the first project window or of the element whose test is run.
(*) The initialization event of a component is run only when the component uses the same execution context as the project. For more details on the component generation options, see Creating and generating an external component.
If Use is run, the project initialization event is interrupted (all the lines of code after Use will not be run).
Examples Some examples of how to use this event: | | Used if the site is run with pre-launched sessions. To manage pre-launched sessions, two events are associated with the project: - project initialization, executed before the request reaches the WEBDEV Application Server. This code is run when starting the pre-launched session.
- initialization in pre-launched session mode, executed when the WEBDEV Application Server processes the request.
Caution: Some WLanguage functions must not be used in the "Project initialization" event. They must be moved to the "Initialization in pre-launched session mode" event. | Close | Executed when the closing application (when the last window of the application is closed for example). Here is the order in which the events for closing the project are run:- Closing the project.
- Event for ending the sets of procedures.
- Event for ending the classes.
- Closing the components (closing the component project, then its sets of procedures, then its classes, then its sub-components).
This event will not be executed:- When EndProgram is run and the "Closing code" parameter is not specified or is set to "False".
- When AppControl is run and the "Run project closing code" parameter is not specified or is set to "False".
| | Run in the following cases if the application is currently used:- When closing the current user session.
- When stopping the system of the current computer.
- When restarting the current computer.
In these cases, only this event will be run. The events for closing the project as well as the events for ending the classes and the sets of procedures will not be run. Note: Depending on the operating system of the current computer, the operating system may try to abruptly stop the application after a while.
Examples Some examples of how to use this event:- Freeing the libraries loaded in memory by FreeDLL (if libraries have been loaded in memory).
- Freeing classes, OLE Automation objects and dynamic arrays (Free keyword).
- Canceling the current transactions (HTransactionCancel).
- Closing the HFSQL files (HClose).
- Sending information messages to other computers (SendMessage).
- Running the event for closing the project with EndProgram with "Closing code" set to "True".
| | Optional event.To enable this event, go to the "Automated tests" tab, "Tests" group, click the dialog box launcher ( ) and select "Enable automated test code of the project". To disable this event, go to the "Automated tests" tab, "Tests" group, click the dialog box launcher ( ) and select "Disable automated test code of the project". In the case of an automated test, this event is run before the project initialization code. This code is used to handle special cases where the automated test may be locked. For example, when a window is opened in the project initialization code (settings, license agreement, custom login window, etc.). The project automated test code allows you to use EmulateWindow to validate the window. | | Executed when the application is moved to the background. This event is used, for example, to save the data. Note: This event is executed AFTER the "Move application to the background" event. | | Executed when the application is re-enabled and when it is moved to the foreground. This event is used, for example, to refresh the displayed data. Remarks: - This event is not run when the application starts.
- This event is executed BEFORE the "Move application to the foreground" event.
| | Run in the following cases: - When the application starts (after the "Initialization" event of the project).
- When the theme is changed in the code with ChangeTheme only if the withCodeExecution constant has been specified.
- When the system automatically changes the theme. This may be related to changes in the system settings, day/night time, battery saver mode, etc.
| | Executed when the WEBDEV Application Server or the application is started.Note: Since scheduled tasks are not persistent in WEBDEV, this event allows you to add scheduled tasks programmatically ( AppServerAddScheduledTask). | | Executed when an application is installed, updated or unlocked. | | Executed when the WEBDEV Application Server is stopped. |
This page is also available for…
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|