ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

This content has been translated automatically.  Click here  to view the French version.
Help / Developing an application or website / Controls, windows and pages / Window
  • Default events
  • Optional events
  • Overview
  • Optional Event: Closing authorization
  • Optional event: Size modification
  • Optional event: Focus capture
  • Optional Event: Loss of focus
  • Optional Event: Each time a change is made
  • Optional Event: Bring application to foreground of window
  • Optional Event: Application background set from window
  • Optional event: Change of layout
  • Optional event: Application of the light/dark theme
  • Optional event: Start of dequeue
  • Optional Event: While dequeueing
  • Optional Event: End of dequeue
WINDEV
WindowsLinuxJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadIOS WidgetApple WatchMac Catalyst
Others
Stored procedures
Events associated with windows
Default events
The following events appear by default in the WINDEV and WINDEV Mobile code editor:
EventRuntime condition
Global declarationsDeclaration of variables global to the window. This is the first code run when opening the window.
End of initializationExecuted when window is opened.
The events are run in the following order:
  • Initialization of the window controls (*)
  • Initialization of the window
  • Focus gain
Remark: If field update code is set in this event, a blinking effect may appear.. Indeed, the initialization code of controls is run before the update code.
ClosingExecuted when closing the window.
Remarks:
  • Resuming the input in one of the window controls in this code prevents the window from closing.
  • If the window contains a "Cancel" Button, only the click code of this button is executed when the window is closed.
Request for refreshing the displayEnables you to group together the update code for the window's fields: field content, status (visible, grayed, etc.), label to be updated, 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.
Android Change of orientation
Executed when the user turns the screen around. This allows you to reposition the controls when changing the orientation of the screen.
Close a child window of the windowExecuted when closing a child window opened from the current window.
You can:
  • use the Name 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.ValeurRenvoyée = True THEN
	ListeCommande()
END
The MyChildWindow keyword is used to manipulate the child window.
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 the description window.
Note: The WidgetDisplay function causes the Widget to be redisplayed and the refresh event to be executed.

(*) By default, the "Initialization" event of each control is executed according to the order in which the controls were created in the window. To modify this runtime order:
  1. On the "Window" tab, in the "Order" group, click "Initialization".
  2. In the window that appears, use the arrows on the right to change the order in which the controls are initialized.
Attention: If one or more fields use field persistence, the "On each modification" code can be executed when the field is initialized.. For more details, see Persistence of controls.
Optional events

Overview

Several optional events can be added. 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.
    Note: Several optional events can be selected.
  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.
Note: If the deactivated code contains WLanguage code, this code is automatically deleted..
For example, you can use the following events:

Optional Event: Closing authorization

This event can be used to make a verification when the window is closed, right before the "Close" 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:
    RETURN 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 Close 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: Size modification

Run in the following cases:
  • Minimizing the window
  • Enlarging or resizing the window
  • Restoring the window once it was minimized

Optional event: Focus capture

Executed when the window gains 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 Close is called in the window initialization code.
  • if the user clicks a window of another program then re-clicks the initial window.
AndroidAndroid Widget This event is not available.

Optional Event: Loss of focus

Executed 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 Close is called in the window initialization code
  • if the user clicks a window of another program then re-clicks the initial window
AndroidAndroid Widget This event is not available.

Optional Event: Each time a change is made

Executed when one of the window controls is modified (input performed by the user for example).
AndroidiPhone/iPadIOS WidgetMac Catalyst

Optional Event: Bring application to foreground of window

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.
Note: This event is executed AFTER the "Foreground" project event..
AndroidiPhone/iPadIOS WidgetMac Catalyst

Optional Event: Application background set from 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 BEFORE the "Background" project event..
WINDEVAndroidiPhone/iPadIOS WidgetMac Catalyst

Optional event: Change of layout

Executed when the layout is automatically modified.
Note: The WinChangeLayout function does not trigger this event..
AndroidiPhone/iPadIOS WidgetMac Catalyst

Optional event: Application of the 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 theme is automatically changed by the system: changing system parameters, day/night time change, activating/deactivating battery saver, etc.
For more details, see Dark theme on mobile devices.

Optional event: Start of dequeue

Executed when the user starts scrolling a window. This event is used to scroll through the content, if necessary.
For example, with this event you can make a control appear when the bottom of the window is reached or when the scrollbar goes up.
Reminder: The ScrollbarPosition function is used to find out the position of the elevator..

Optional Event: While dequeueing

Executed when the user scrolls the window. This event is used to scroll through the content, if necessary.
For example, with this event you can make a control appear when the bottom of the window is reached or when the scrollbar goes up.
Reminder: The ScrollbarPosition function is used to find out the position of the elevator..

Optional Event: End of dequeue

Executed when the user stops scrolling the window. This event is used to scroll through the content, if necessary.
For example, with this event you can make a control appear when the bottom of the window is reached or when the scrollbar goes up.
Reminder: The ScrollbarPosition function is used to find out the position of the elevator..
Minimum version required
  • Version 9
This page is also available for…
Comments
Click [Add] to post a comment

Last update: 09/24/2024

Send a report | Local help