Open window instance

Command groupFlag affectedReversibleExecute on clientPlatform(s)
WindowsNOYESNOAll

Syntax

Open window instance
 
class[/instance] [/l/t/r/b/cen/max/min/stk] [(params)]

Description

This command opens an instance of the specified window class. You can specify the position and size of the window instance (using the left, top, right, bottom coordinates in pixels), and you can center, maximize, minimize, and stack the window. Furthermore, you can send a list of parameters to the window’s $construct() method.

Open window instance lets you open multiple instances of the same window class. The default instance name for a window is the class name, but if you want to open multiple instances of the same window class you must assign a unique name to each instance. Window instance names are case-sensitive.

Window Position and Size

You can specify the position of the top-left corner of the window instance by adding the coordinates to the end of the window-name/instance-name parameter, that is, window-name/instance-name/left/top. You specify the position in pixels, the origin being /0/0, that is, under the menu bar. By providing all four coordinates, you can specify the position and size of the window instance.

Centering and Stacking Windows

The /CEN option automatically centers the window instance. You can include the four window size coordinates with the /CEN option so the window is sized and centered.

The /STK option opens the window instance about 12 pixels (the stack offset) to the right and down from the current top window. When a stacked window reaches the edge of the screen, it is placed back at the top of the stack, offset slightly from the first window.

Maximizing and Minimizing Windows

The /MAX option opens and maximizes the window instance. If you include the position and size coordinates with this option, the window is opened with the specified position and size and then maximized.

The /MIN option opens and minimizes the window instance. If you include the position and size coordinates with this option, the window is opened with the specified position and size and then minimized.

$construct() Method and Passing Parameters

When you open a window instance, the $construct() method for that instance is run. In this method, you place commands which set up the conditions required by the window. For example, you may want to set the main file, build particular lists, and so on. Just as with Do method and Do code method you can send parameters to the window using Open window instance.

Reversible blocks in the $construct() method do not reverse until the window instance is closed, unlike a normal method whose reversible blocks reverse on termination of the method.

Example

# Open 2 instances of the window wMyWindow stacked

Open window instance
 
wMyWindow/wInst1/CEN

Open window instance
 
wMyWindow/wInst2/STK

 
# Alternatively, you can let Omnis assign enumerated names to

# multiple instances by specifying ‘*’ as the instance name.

Open window instance
 
wMywindow/*

Open window instance
 
wMywindow/*

 
# Specify the size and location when opening the window

# wMyWindow

Open window instance
 
wMyWindow/*/10/10/100/100

 
# Specify the size and location in variables

Calculate
 
lLeft
 as 
10

Calculate
 
lRight
 as 
100

Calculate
 
lTop
 as 
10

Calculate
 
lBottom
 as 
100

Open window instance
 
wMyWindow/*/[
lLeft
]/[
lTop
]/[
lRight
]/[
lBottom
]

 
# Open the window wMyWindow maximized

Open window instance
 
wMyWindow/*/MAX

 
# Open the window wMyWindow minimized

Open window instance
 
wMyWindow/*/MIN

 
# Open the window wMyWindow and pass the variables lMyVar1 and lMyVar2

# to it's $construct method

Open window instance
 
wMyWindow/*/ (
lMyVar1
,
lMyVar2
)