ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Help / Developing an application or website / Controls, windows and pages / Window
  • Overview
  • Opening a window
  • Opening a parent window
  • Opening a child window
  • Opening a sibling window
  • Opening with alias
  • Overlaying windows
  • Minimizing a window
  • "Free" window opened by OpenChild or OpenSister
  • MDI parent window
  • MDI child window
  • Reminder
  • Current window
  • Closing a child window or a sibling window
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
Non-modal management of a window
Overview
The window that opens another window is called parent window ; the windows opened by the parent window are called child windows. All the child windows opened by the same parent window are sibling windows.
This opening mode allows you to manage the multi-windowing.
In non-modal opening of a child window:
  • the child window can be in edit at the same time as the parent window that opened it.
  • once a child window is closed, another child window becomes the current window; if there is no child window, the parent window becomes the current window
  • if the parent window is closed, its child windows are closed. If a child window refuses to be closed, the parent window and the child windows following this window will not be closed.
  • if the child window is minimized, the other windows are not minimized. The icon of the window is the one of the window (or the one of the project if the window has no icon).
  • if the parent window is minimized, all the child windows become temporarily invisible.
Non-modal opening of a sibling window:
  • all the sibling windows can be in edit mode at the same time.
  • when a sibling window is closed, another sibling window becomes the current window.
  • if the sibling window is minimized, the other windows are not minimized. The icon of the window is the one of the window (or the one of the project if the window has no icon).
Opening a window

Opening a parent window

A parent window is opened by Open.

Opening a child window

A child window is opened from a MDI parent window. These child windows can have the following types:
  • "MDI child"
  • "Free"
The opening mode of the window depends on the type of window.
1. "MDI child" window
MDIOpen opens a modeless "MDI child" window from an "MDI parent" window.
The following operations are performed when MDIOpen is called:
  1. Running the "Global declarations" event of the window.
  2. Running the initialization events of the controls (the order is undefined).
  3. Displaying the window (this window is always a child window of the MDI parent window).
    Remark: The MDI child windows are always opened in the parent window (they cannot be displayed outside the parent window). MDIWindowMenu is used to organize the display of MDI child windows in the MDI parent window (cascading display or tiled display).
SetFocusAndReturnToUserInput is used to force the input in the child window.
2. "Free" window opened as child window
OpenChild opens modeless "Free" windows from an "MDI parent" window.
The following operations are performed when OpenChild is called:
  1. Running the "Global declarations" event of the child window,
  2. Running the initialization events of the controls (the order is undefined),
  3. Running the events following the call to OpenChild of the parent window,
  4. Display the child window (the parent window remains the current window).
    Remark: The non-MDI child windows can be displayed outside the parent window, they can be displayed anywhere on the screen.
SetFocusAndReturnToUserInput is used to force the input in the child window.

Opening a sibling window

A sibling window is opened from a child window. These child windows can have the following types:
  • "MDI child"
  • "Free"
The opening mode of the window depends on the type of window.
1. "MDI child" window
MDIOpen opens a modeless "MDI Child" window from a "MDI parent" or "MDI child" window. The different child windows are sibling windows.
2. "Free" window opened as sibling window
OpenSister is used to perform a non-modal opening of "Free" windows from a child window.
The following operations are performed when OpenSister is called:
  1. Running the "Global declarations" event of the sibling window,
  2. Running the initialization events of the controls (the order is undefined),
  3. Running the events following the call to OpenSister of the calling window,
  4. Displaying the sibling window.
    Remark: The MDI sibling windows are always opened in the parent window (they cannot be displayed outside the parent window). MDIWindowMenu is used to organize the display of MDI child windows in the MDI parent window (cascading display or tiled display).
SetFocusAndReturnToUserInput is used to force the input in the sibling window.
Important: A window can be opened by OpenSister only if the window that requested the opening was opened by OpenChild or by OpenSister.

Opening with alias

The same window (child or sibling window) can be opened several times. This window is its own sibling window. Each opened window is identified by an alias. The alias is passed as parameter to OpenSister, OpenChild or MDIOpen. If no alias is specified when opening a window that is already opened, WINDEV automatically assigns an alias to the window.
Remark: The alias can be modified by WinChangeAlias.
This alias is used to identify windows with functions that take a window name as a parameter (CurrentTitle, NextTitle, SetFocusAndReturnToUserInput, etc.) or to handle a control in a given window.
The alias is returned by CurrentWin or PreviousWin.
// Open CUSTFORM with CUSTOMER1 alias
OpenSister("CUSTOMER1=CUSTFORM")
 
// Change of window with input in CUSTNAME control
SetFocusAndReturnToUserInput("CUSTOMER1.CUSTNAME")
 
// Handle a control with alias
WindowName is string
WindowName = PreviousWin()
IF WindowName.CustName = "" THEN
// Customer name not entered
Error("No customer name was entered")
SetFocusAndReturnToUserInput(WindowName + ".CUSTNAME")
END
Overlaying windows
After its opening, a child window is displayed "on the top" of parent window and a sibling window is displayed on top of the last but one sibling window.
To specify that the opened window is displayed:
  • above all windows (even the inactive ones), including windows from other current Windows applications, you must use the AboveAll constant (OpenChild, OpenSister or WinStatus).
  • above its sibling windows (even the inactive ones), you must use the Above constant (OpenChild, OpenSister or WinStatus).
Minimizing a window

"Free" window opened by OpenChild or OpenSister

If the window is minimized, the other windows are not minimized. The icon used is the one of the window (or the one of the project if the window has no associated icon).

MDI parent window

If the window is minimized, all the child windows are minimized. The icon used is the one of the window (or the one of the project if the window has no associated icon).

MDI child window

When it is minimized, the window is minimized in the parent window, the icon appears in the title bar.
MDIWindowMenu is used to minimize all MDI child windows and to restore them.

Reminder

A window can be minimized:
A window can be restored:
Current window
Once a window is opened, the current window is not modified.
  • CurrentWin returns the name of the window (or alias) that has the focus.
  • PreviousWin returns the name of window (or alias) that previously had the focus.
To change the window currently in edit:
  • the user clicks another window.
  • use SetFocusAndReturnToUserInput to force input in the window passed as parameter (the window must include at least one editable control).
MDIActive returns the name of the MDI child window that is displayed in the foreground.
Closing a child window or a sibling window
Child and sibling windows are closed with Close.
Once a child window is closed, one of its sibling windows becomes active. If no sibling window exists, the parent window becomes active.
Once a sibling window is closed, another sibling window becomes the current window.
If the parent window is closed, its child windows are closed. If a child window refuses to be closed, the closing is interrupted: the parent window and the sibling windows that follow the child window are not closed ; the child windows that are already closed remain closed.
To prevent a non-MDI child window from being closed, the following line must be added into the closing code of the child window:
// ControlName is a control of the child window
SetFocusAndReturnToUserInput(ControlName)
To prevent an MDI child window from closing,:
  • create a Button control associated with the Alt + F4 key combination.
  • write the following code in the click code of the Button control:
    SetFocusAndReturnToUserInput()
MDIWindowMenu closes all MDI child windows.
Minimum version required
  • Version 9
This page is also available for…
Comments
Click [Add] to post a comment

Last update: 07/04/2023

Send a report | Local help