PC SOFT

ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Home | Sign in | English EN
  • Codes executed at closing
  • Closing according to the type of window
  • Last project window
  • First project window
  • Value returned to the Open function
  • Value returned when closing a child window
  • Alt + F4 keys
  • Equivalence
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
Closes a WINDEV window (and returns a value if necessary).
WEBDEV - Server codeWindowsLinux This function is available only to simplify the Webification of WINDEV projects. In a WEBDEV site, this function has the same behavior as PageCloseDialog or ContextClose, according to each case.
Example
// Close the "WIN_Edit" window
Close(WIN_Edit)
Reports and QueriesWindowsLinuxiPhone/iPadApple WatchUser code (UMC)
// Close the "WIN_EditUsername" window
// and retrieve several return values
Close(WIN_EditUsername, LastName, FirstName)
Syntax
Close([<Window> [, <Returned value> [... [, <Returned value N>]]]])
<Window>: Optional window name
Name of window to close. If this parameter is not specified or if it corresponds to 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.
WINDEVJava This value is retrieved only if the window was opened by Open.

Universal Windows 10 AppAndroidiPhone/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)
WINDEVReports and QueriesWindowsLinuxiPhone/iPadApple WatchUser code (UMC) Value N returned by the window when it is closed (if several values are returned).
WINDEV This value is retrieved only if the window was opened by Open.

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 "Closing" event of the window is executed.
  • If SetFocusAndReturnToUserInput is called in the "Closing" 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:
    // Procedure called by timer
    Window is string
    Window = CurrentWin()
    IF Window <> "Window name" 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 "Closing" 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.
WINDEVReports and QueriesJavaUser code (UMC)

Value returned to the Open function

Close can be used to return one or more values to Open.
Reminder: A value can also be returned by the ReturnedValue property (<Window name>.ReturnedValue) run before Close. In this case, a single value can be returned.
Examples:
  • The user must type a password in a window. This password is retrieved when this window is closed and it is returned to Open:
    MyPassword = Open(WIN_EditPassword)
    IF MyPassword <> "" THEN
    Info("Wrong password")
    END
     
    // -- Click code on "OK" button in the "WIN_EditPassword" window
    // Users enter their password in the EDT_Password control
    // and validates the window.
    Close("", EDT_Password)
  • The user must enter a username and a password in a window. The username and password are retrieved when the window is closed and returned to Open:
    (MyUsername, MyPassword) = Open(WIN_EditPassword)
    IF MyUsername <> "" OR MyPassword <> "" THEN
    Info("Wrong username or password")
    END
     
    // -- Click code on "OK" button in the "WIN_EditPassword" window
    // Users enter their username and password
    // in the EDT_Password control and validates the window.
    Close("", EDT_Username, EDT_Password)
Universal Windows 10 AppAndroidiPhone/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: A value can also be returned by the ReturnedValue property (<Window name>.ReturnedValue) run before Close.
The value returned by the child window can be read in the "Closing a child window" event of the window that opened it (the one that called OpenMobileWindow or OpenChild): 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("", MyParameter)
  • The name of the child window as well as the returned value can be retrieved in the "Closing a child window" event of the calling window, using the MyChildWindow keyword:
    // Close a child window
    NameChildWindow = MyChildWindow.Name
    ValueChildWindow = MyChildWindow.ReturnedValue

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: wd280obj.dll
Minimum version required
  • Version 9
This page is also available for…
Comments
Click [Add] to post a comment