ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Help / Editors / Project editor
  • Default events
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadIOS WidgetApple WatchMac CatalystUniversal Windows 10 App
Others
Stored procedures
Default events
WINDEV, WEBDEV and WINDEV Mobile handle the following events by default (order of appearance in the code editor):
EventRuntime condition
InitializingRun 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 cached sessions.
To manage pre-launched sessions, two events are associated with the project:
  • "Initializing the project", run before the request reaches the WEBDEV application server. This code is run when starting the pre-launched session.
  • "Initializing the project after connection to the site", run when the WEBDEV application server processes the request.
Caution: Some WLanguage functions must not be used in the event "Initializing the project". They must be moved to the event "Initializing the project after connection to the site".
For more details, see Pre-launched sessions.
ClosingRun 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.
Remark: 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 (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 (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 us used to process some special cases where the automated test may be locked: opening a window in the initialization code of the project (configuration window, license window, custom login window, ...).

The project automated test code allows you to use EmulateWindow to validate the window.
AndroidiPhone/iPad Move to the background
Run when the application is moved to the background. This event is used, for example, to save the data.
Remark: This event is run AFTER the optional window event "Move application to the background".
AndroidiPhone/iPad Move to the foreground
Run 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 run BEFORE the optional window event "Move application to the foreground".
AndroidiPhone/iPad Application of light/dark theme
Run in the following cases:
  • When the application starts (after the "Initializing" 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: modification of system settings, changing the day/night time, activating/deactivating the battery saver, etc.
Remark: This event is only available if dark theme management is enabled. For more details, see Dark theme management on mobile.
Executed when the WEBDEV Application Server or the application is started.
Remark: 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.
Minimum version required
  • Version 9
This page is also available for…
Comments
Click [Add] to post a comment

Last update: 05/26/2022

Send a report | Local help