ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

This content has been translated automatically.  Click here  to view the French version.
Help / WLanguage / WLanguage functions / Controls, pages and windows / Window functions
  • Codes executed at closing
  • Closing according to the type of window
  • Last project window
  • First project window
  • Value returned when closing a child window
  • Alt + F4 keys
  • Equivalence
WINDEV
WindowsLinuxJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadIOS WidgetApple WatchMac Catalyst
Others
Stored procedures
Closes a WINDEV window (and returns a value if necessary).
Example
// Fermeture de la fenêtre "FEN_Saisie" 
Close(FEN_Saisie)
iPhone/iPadApple Watch
// Fermeture de la fenêtre "FEN_SaisieLogin" 
// avec récupération de plusieurs valeurs de retour
Close(FEN_SaisieLogin, Nom, Prénom)
Syntax
Close([<Window> [, <Returned value> [... [, <Returned value N>]]]])
<Window>: Optional window name
Name of window to close. If this parameter is not specified or is an empty string (""), the current window is closed.
<Returned value>: Type corresponding to the returned value (optional)
Value returned by the window when it is closed.

AndroidiPhone/iPadApple Watch This value is retrieved only if the window was opened by OpenMobileWindow (or by OpenChild).
You have the ability to return:
  • simple types (character string, boolean, ...).
  • advanced types: structure, dynamic structure, class, advanced type, array, associative array, queue, stack, list.
<Returned value N>: Type corresponding to the returned value (optional)
iPhone/iPadApple Watch Value N returned by the window when it is closed (if several values are returned).

iPhone/iPadApple Watch This value is retrieved only if the window was opened by OpenMobileWindow (or by OpenChild).
You have the ability to return:
  • simple types (character string, boolean, ...).
  • advanced types: structure, dynamic structure, class, advanced type, array, associative array, queue, stack, list.
Remarks

Codes executed at closing

  • When closing a window:
    1. The current process is permanently interrupted.
    2. The "Close" event of the window is executed.
  • If SetFocusAndReturnToUserInput is called in the "Close" event, the window is not closed.
  • If Close is run in a procedure called by Timer, WinStatus or CurrentWin must be used to confirm the existence of the window to close, otherwise all open windows may be closed. For example:
    // Procédure appelée par timer
    Fenêtre is string 
    Fenêtre = CurrentWin()
    IF Fenêtre <> "Nom fenêtre" THEN
    	Close()
    END

Closing according to the type of window

  • If the window to close is a parent window with child windows, these child windows will be closed first (their closing code is run).
  • If the window to close is a child window, the parent window becomes the current window. The "gain of focus" code of parent window is run.

Last project window

If the last window is closed, the "Close" event of the project is executed before the end of the program.
iPhone/iPadApple Watch

First project window

Close used on the first project window means that the application will be ended. This function should only be used for debugging as the license of this type of hardware does not allow closing the application.
AndroidiPhone/iPadApple Watch

Value returned when closing a child window

Close is used to return a value to the parent window that opened the child window.
Reminder: It is also possible to return a value using the property ReturnedValue (<Window Name>.ReturnedValue) executed before the Close function.
The value returned by the child window can be read in the "Close child window" event of the window that opened the child window (the one that used the OpenMobileWindow or OpenChild function): simply use the ReturnedValue property on the MyChildWindow keyword.
For example:
  • In the closing code of the child window, Close is used to return a parameter:
    Close("", MonParamètre)
  • The name of the child window as well as the returned value can be retrieved in the "Close a child window" event of the calling window, using the MyChildWindow keyword:
    // Fermeture d'une fenêtre fille
    NomFenêtreFille = MyChildWindow.Nom
    ValeurFenêtreFille = MyChildWindow.ValeurRenvoyée

Alt + F4 keys

Pressing Alt + F4 can trigger several behaviors:
  • If the window contains an "Abandon" button, the WLanguage event associated with the abandon button is executed.
  • If the window has a button with Alt + F4 as keyboard shortcut, the WLanguage event associated with this button is executed.
  • If the window does not contain an "abandon" button, or a button with Alt + F4 as keyboard shortcut, the closing process of the window is executed and the window is closed (except if SetFocusAndReturnToUserInput is called).
  • If a window is opened from a program in external language, Alt + F4 returns "ESC" in WdKey.

Equivalence

The following line of code:
WinStatus(<Window>, NotFound)
is equivalent to:
Close(<Window>)
Component: wd300obj.dll
Minimum version required
  • Version 9
This page is also available for…
Comments
Click [Add] to post a comment

Last update: 03/28/2025

Send a report | Local help