ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Help / WLanguage / WLanguage syntax / Reserved keywords
  • Handling the current window
  • Using MyWindow in a procedure
  • WLanguage functions and current window
  • Summary
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
MyWindow is used to handle the current window. During the execution of the window, MyWindow is replaced with the window (and not by the name of the window). Therefore, MyWindow can be used like a window.
Benefit: MyWindow is used to make local code (control, button, ...) or global code (global procedure, class, ...) independent of the current window.
Example
// Retrieve the title of the current window
WindowTitle = MyWindow.Title
Syntax
MyWindow
Remarks

Handling the current window

  • MyWindow is always replaced with the current window. For example, using the Title property:
    MyWindow..Title = "Type your data"
    MyCurrentTitle = MyWindow..Title
     
    // Pass as parameter:
    CallProcedure(MyWindow)
  • If the MyWindow keyword must be converted to a string, the result of the Value property is returned. For a window, the Value property returns the title of the window.
    Trace(MyWindow) // Returns the title of the window

    Example not to do:
    ExecuteProcess(MyWindow, trtChange)

    To do:
    ExecuteProcess(MyWindow.Name, trtChange)
  • MyWindow can only be used in the processes that handle the current window (in the processes associated with a control, a window, ...). MyWindow cannot be used in a report. To specify the current report in a report, use MyReport
  • The MyWindow keyword does not allow you to use the global variables declared in the window.
  • To handle a window control by using the MyWindow keyword, you have the ability to use the following syntax:
    Info({MyWindow.Name + ".Button2"}..Caption)

Using MyWindow in a procedure

The MyWindow keyword can be used in a local procedure or in a global procedure only if the procedure handles the current window. In this case, MyWindow refers to the current window.
With a local procedure, MyWindow corresponds to the window to which the procedure belongs.

WLanguage functions and current window

To specify the current window in the WLanguage functions that accept a window name as parameter, use:
  • an empty string,
  • MyWindow.

Summary

Code where MyWindow is usedMyWindow corresponds to
windowwindow
window controlwindow
window procedure, with a direct call from a window codewindow
window procedure, with a call via <Window>.<Procedure>window
window supercontrolwindow
control of window supercontrolwindow
procedure of window supercontrol with a direct call from a code of the supercontrolwindow
procedure of window supercontrol with a call via <Supercontrol>.<Procedure>window
internal windowwindow
control of internal windowwindow
procedure of internal window with a direct call from a code of the internal windowwindow
procedure of internal window with a call via <InternalWindow>.<Procedure>window
supercontrol of internal windowwindow
control of supercontrol of internal windowwindow
procedure of supercontrol of internal window with a direct call from a code of the supercontrolwindow
procedure of supercontrol of internal window with a call via <Supercontrol>.<Procedure>window

The MyWindow keyword can only be used from a window process or procedure
Limitation: MyWindow cannot be used in a secondary thread. For more details on how to manipulate windows in threads, see Opening a window in a secondary thread.
Minimum version required
  • Version 9
This page is also available for…
Comments
Click [Add] to post a comment

Last update: 05/26/2022

Send a report | Local help