PC SOFT

ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Home | Sign in | English EN
This content has been translated automatically. Click here to view the French version.
  • Events managed by default
  • Optional events
  • Overview
  • Optional event: Allow closing
  • Optional event: Resizing
  • Optional event: Focusing
  • Optional event: Perte de focus
  • Optional event: With each modification
  • Optional event: Move application to the foreground
  • Optional event: Move the application to the background
  • Optional event: Change of layout
  • Optional event: Application of light/dark theme
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
Events associated with windows
Events managed by default
WINDEV and WINDEV Mobile manage the following events by default (order of appearance in the code editor):
EventRuntime condition
Global statementsDeclaring the variables global to the window. This is the first code run when opening the window.
End of initializationRun when the window is opened.
The events are run in the following order:
  • Initialization of the window fields (*)
  • Initializing the window
  • Focusing
Remark: A blinking effect may appear if the code for updating the controls is included in this event. Indeed, the initialization code of controls is run before the update code.
ClosingRun when closing the window.
Remarks:
  • Resuming the input in one of the window controls in this code prevents from closing the window.
  • If the window contains a "Cancel" Button, only the click code of this button is executed when the window is closed.
Versions 20 and later
Request for refreshing the display
New in version 20
Request for refreshing the display
Request for refreshing the display
Used to group the code for updating the window controls: content of controls, state (visible, grayed, etc.), caption to refresh, etc.
This event can receive parameters. Simply declare a procedure in the event. For example:
// Request for refreshing the display
PROCEDURE AskForRefresh(RefreshType is boolean)
This event is started upon request by the following functions:
When these functions are called, you can specify the value of the parameters expected by the event.
Versions 17 and later
Universal Windows 10 AppAndroid Change of orientation
New in version 17
Universal Windows 10 AppAndroid Change of orientation
Universal Windows 10 AppAndroid Change of orientation
Run when the user turns the screen around. This allows you to reposition the controls when changing the orientation of the screen.
Closing a child window of the windowRun when closing a child window opened from the current window.
It is possible to:
  • use the nom property to get the name of the child window that was closed.
  • use the ReturnedValue property to get the return value of the child window.Example:
// -- Fermeture d'une fenêtre fille de FEN_ListeCommande
// Actualise la liste des commandes si besoin
IF MyChildWindow.ReturnedValue = True THEN
ListeCommande()
END
The MyChildWindow keyword is used to manipulate the child window.
Versions 18 and later
Android Widget Refreshing the widget
New in version 18
Android Widget Refreshing the widget
Android Widget Refreshing the widget
Used to update the widget content. This event is run:
  • when opening a Widget window.
  • at regular time interval. This interval is defined in the "Details" tab of description window.
Remark: WidgetDisplay redisplays the widget and runs the refresh event.

(*) By default, the "Initializing" event of each control is run according to the order in which the controls were created in the window. To modify this order of execution:
  1. On the "Window" tab, in the "Order" group, click "Initialization".
  2. In the window displayed, use the arrows on the right to modify the order in which the controls are initialized.
Caution: If one or more controls use the persistence of controls, the "Whenever modified" code can be run when initializing the control. For more details, see Persistence of controls.
Optional events

Overview

Several optional events can be managed. To add an optional event:
  1. Select the desired control.
  2. Display the code window of this control (F2 key).
  3. Click the link "Add other events to xxx" at the bottom of the window code, after the last event.
  4. All the optional events available for the control are displayed.
  5. Check the optional event to add and validate.
    Remark: You can select several optional events.
  6. The selected optional event is automatically added to the events managed by the control.
To disable an optional event, simply perform the same operations to display the list of optional events. Then simply uncheck the optional events to delete.
Remark: If the disabled code contains WLanguage code, this code is automatically deleted.
You can manage, for example:
  • the mouse hover over the control,
  • left mouse button down, up, with a double click,
  • the right mouse button down, up, with double click,
  • the mouse wheel, etc.
Versions 26 and later

Optional event: Allow closing

This event can be used to make a verification when the window is closed, right before the "Closing" event is executed.
This event can be used to:
  • request a confirmation,
  • prevent the window from closing. To do so, simply write the following line of code:
    RESULT False
Caution:
  • if the window contains a "Cancel" Button, only the click code of this button is executed when the window is closed.
  • the "Allow closing" event is executed only when the window is closed via the "X" button. This event is not executed when ferme is called.
iPhone/iPad This event is automatically enabled when for windows in "Sheet" mode. In this mode, a swipe down gesture:
  • Executes the "Allow closing" event.
  • Closes the window if the "Allow closing" event returns True.
New in version 26

Optional event: Allow closing

This event can be used to make a verification when the window is closed, right before the "Closing" event is executed.
This event can be used to:
  • request a confirmation,
  • prevent the window from closing. To do so, simply write the following line of code:
    RESULT False
Caution:
  • if the window contains a "Cancel" Button, only the click code of this button is executed when the window is closed.
  • the "Allow closing" event is executed only when the window is closed via the "X" button. This event is not executed when ferme is called.
iPhone/iPad This event is automatically enabled when for windows in "Sheet" mode. In this mode, a swipe down gesture:
  • Executes the "Allow closing" event.
  • Closes the window if the "Allow closing" event returns True.

Optional event: Allow closing

This event can be used to make a verification when the window is closed, right before the "Closing" event is executed.
This event can be used to:
  • request a confirmation,
  • prevent the window from closing. To do so, simply write the following line of code:
    RESULT False
Caution:
  • if the window contains a "Cancel" Button, only the click code of this button is executed when the window is closed.
  • the "Allow closing" event is executed only when the window is closed via the "X" button. This event is not executed when ferme is called.
iPhone/iPad This event is automatically enabled when for windows in "Sheet" mode. In this mode, a swipe down gesture:
  • Executes the "Allow closing" event.
  • Closes the window if the "Allow closing" event returns True.

Optional event: Resizing

Run in the following cases:
  • Minimizing the window
  • Enlarging or resizing the window
  • Restoring the window once it was minimized
Universal Windows 10 App This event is not available.

Optional event: Focusing

Run when the window takes focus (the title bar is active) and when another window loses focus:
This event will not be executed:
  • when opening the first project window.
  • when running OpenChild, OpenMobileWindow or OpenSister from the current window.
  • if ferme is called in the window initialization code.
  • if the user clicks a window of another program then re-clicks the initial window.
Universal Windows 10 AppAndroidAndroid Widget This event is not available.

Optional event: Perte de focus

Run when the window loses focus when going to another window. This event is always called before the focus gain event of another window in the following cases:
  • closing the window (before the closing event)
  • the user clicked another window of the application
  • SetFocusAndReturnToUserInput was run from another window of the application
This event will not be executed:
  • if SetFocusAndReturnToUserInput to another window was run in the window initialization code
  • if ferme is called in the window initialization code
  • if the user clicks a window of another program then re-clicks the initial window
Universal Windows 10 AppAndroidAndroid Widget This event is not available.

Optional event: With each modification

Run when one of the window controls is modified (input performed by the user for example).
Versions 18 and later
AndroidiPhone/iPadIOS WidgetMac Catalyst

Optional event: Move application 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.
Remark: This event is run AFTER the event "Move to the foreground" of the project.
New in version 18
AndroidiPhone/iPadIOS WidgetMac Catalyst

Optional event: Move application 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.
Remark: This event is run AFTER the event "Move to the foreground" of the project.
AndroidiPhone/iPadIOS WidgetMac Catalyst

Optional event: Move application 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.
Remark: This event is run AFTER the event "Move to the foreground" of the project.
Versions 18 and later
AndroidiPhone/iPadIOS WidgetMac Catalyst

Optional event: Move the application 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 executed BEFORE the event "Move to the background" of the project.
New in version 18
AndroidiPhone/iPadIOS WidgetMac Catalyst

Optional event: Move the application 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 executed BEFORE the event "Move to the background" of the project.
AndroidiPhone/iPadIOS WidgetMac Catalyst

Optional event: Move the application 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 executed BEFORE the event "Move to the background" of the project.
Versions 23 and later
WINDEVAndroidiPhone/iPadIOS WidgetMac Catalyst

Optional event: Change of layout

Run when the layout is automatically modified.
Remark: WinChangeLayout does not trigger this event.
New in version 23
WINDEVAndroidiPhone/iPadIOS WidgetMac Catalyst

Optional event: Change of layout

Run when the layout is automatically modified.
Remark: WinChangeLayout does not trigger this event.
WINDEVAndroidiPhone/iPadIOS WidgetMac Catalyst

Optional event: Change of layout

Run when the layout is automatically modified.
Remark: WinChangeLayout does not trigger this event.
Versions 25 and later
AndroidiPhone/iPadIOS WidgetMac Catalyst

Optional event: Application of light/dark theme

If the dark theme is enabled in the project, the optional event "Application of light/dark theme" is available. This event allows you to manage special cases to switch between light and dark theme.
This event is run in the following cases:
  • When the window is opened, after the "Global declarations" event and before the initialization events of the window controls.
  • If the window is already open when the theme is changed with ChangeTheme, only if the withCodeExecution constant has been specified.
  • If the window is already open when the system automatically changes the theme: modification of system settings, changing the day/night time, activating/deactivating the battery saver, etc.
For more details, see Dark theme management on mobile.
New in version 25
AndroidiPhone/iPadIOS WidgetMac Catalyst

Optional event: Application of light/dark theme

If the dark theme is enabled in the project, the optional event "Application of light/dark theme" is available. This event allows you to manage special cases to switch between light and dark theme.
This event is run in the following cases:
  • When the window is opened, after the "Global declarations" event and before the initialization events of the window controls.
  • If the window is already open when the theme is changed with ChangeTheme, only if the withCodeExecution constant has been specified.
  • If the window is already open when the system automatically changes the theme: modification of system settings, changing the day/night time, activating/deactivating the battery saver, etc.
For more details, see Dark theme management on mobile.
AndroidiPhone/iPadIOS WidgetMac Catalyst

Optional event: Application of light/dark theme

If the dark theme is enabled in the project, the optional event "Application of light/dark theme" is available. This event allows you to manage special cases to switch between light and dark theme.
This event is run in the following cases:
  • When the window is opened, after the "Global declarations" event and before the initialization events of the window controls.
  • If the window is already open when the theme is changed with ChangeTheme, only if the withCodeExecution constant has been specified.
  • If the window is already open when the system automatically changes the theme: modification of system settings, changing the day/night time, activating/deactivating the battery saver, etc.
For more details, see Dark theme management on mobile.
Minimum version required
  • Version 9
This page is also available for…
Comments
Click [Add] to post a comment