MSM-Workstation
Macros

Go back to the alphabetic list of macros
Go back to the first page of this tutorial

%%DoWin ( WinName [ , Parameters [ , Settings ] ] )

Invoke a window, passing it parameters and settings.

WinName A string literal (without quotes) representing the name of a window, or an at-sign followed by the name of a local variable (@name) where the value of that variable is expected to be equal to the name of a window at run-time.

Parameters Either an expression or a period, followed by the name of an (unsubscripted) array (similar to an array passed "by reference" to a subroutine or function). When the name of an array is specified, this array can contain both input and output variables stored in named subnodes. Within the called window the array is accessed using the macro %%IOVar. Any structure may be manipulated in this array.

Settings An expression or array containing properties and settings which will override property settings already in the window. Format alternatives are:

  1. Parent - If Settings is an expression not containing a "=", it indicates the name of the parent of the window
  2. Property list - Settings may specify multiple properties using the format: Property=Value|Property=Value|...
  3. Array - Settings may be a period, followed by the name of an (unsubscripted) array (similar to an array passed "by reference" to a subroutine or function). When this is the case, the parameter is assumed to be an array containing the specifications. The subscripts are names of properties, the values of the array elements are the corresponding property values.
    When this format is being used, properties of components can be defined as well as properties the window. If properties of components are to be specified, the value of the first subscript in the array must be the constant "C", the second subscript must be the name of the component, and the third subscript must be the name of the MWAPI attribute that corresponds to the property (reminder: names of properties look like "DefaultButton"; names of MWAPI attributes look like "DEFBUTTON"). Within the called window the array may be accessed using the macro %%Settings, although this is not normally necessary. When the parameter Settings corresponds to either of the first two formats, an array that corresponds to the third format will be constructed.

The macro %%DoWin causes a window to be loaded, if necessary, makes it visible, sets the focus to the starting control, if any, and executes the window by calling its compiled window program. The window need not have first been loaded or opened, %%DoWin includes %%OpenWin. However a window may be preloaded invisible using %%OpenWin so that it appears quickly when %%DoWin is called. In this case it must also be created with the Modal property equal to APPLICATION unless the window is being called as the first GUI operation of the M process.

Examples

%%DoWin(WinName,,%%CurrWin)
Invoke the window called "WinName"
In this case, the third parameter specifies that the current window is the parent of the invoked window.

%%DoWin(Edit,.P,"Parent=%%CurrWin| Color=%%Cyan|PosTop=5|PosLeft=20")
Invoke the window called "Edit", send and return parameters in the array P(), use indicated settings for the window properties.

Kill Settings Set Settings("Parent")=%%CurrWin
Set Settings("Color")=%%Cyan
Set Settings("PosTop")=5
Set Settings("PosLeft")=20
Set Settings("C","TextBox1","VALUE")="Sample value"
Set Settings("C","TextBox1","FCOLOR")=%%Red
%%DoWin(Edit,.P,.Settings)

Invoke the window called "Edit", send and return parameters in the array P(), use indicated settings from the array Settings. In addition to the previous example, several attributes of a component are defined in this case.

%%DoWin(@EDIT,.P,.PROP)
Invoke the window identified by variable EDIT, use the array P() for parameters, get settings out of the array PROP().

See also

%%Do, %%OpenWin, %%Return, %%Cancel and Window Event Notes.