This document covers the following topics:
For an explanation of the symbols used in the syntax diagram, see Syntax Symbols.
Related Statements: INPUT
| REINPUT
|
SET WINDOW
Belongs to Function Group: Screen Generation for Interactive Processing
The DEFINE WINDOW
statement is used to specify the size,
position and attributes of a window.
A window is that segment of a logical page, built by a program, which is displayed on the terminal screen. There is always a window present, although you may not be aware of its existence: unless specified differently, the size of the window is identical to the physical size of your terminal screen.
A DEFINE WINDOW
statement does not activate a window; this
is done with a SET WINDOW
statement or with the WINDOW
clause of an
INPUT
statement.
Note:
There is always only one Natural window, that is, the most
recent window. Any previous windows may still be visible on the screen, but are
no longer active and are ignored by Natural. You may enter input only in the
most recent window. If there is not enough space to enter input, the window
size must be adjusted first.
Operand Definition Table:
Operand | Possible Structure | Possible Formats | Referencing Permitted | Dynamic Definition | ||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
operand1
|
C | S | N | P | I | yes | no | |||||||||||||
operand2
|
C | S | N | P | I | yes | no | |||||||||||||
operand3
|
C | S | N | P | I | yes | no | |||||||||||||
operand4
|
C | S | N | P | I | yes | no | |||||||||||||
operand5
|
C | S | A | U | yes | no |
Syntax Element Description:
Syntax Element | Description |
---|---|
window-name
|
The window-name
identifies the window. The name may be up to 32 characters long. For a window
name, the same naming conventions apply as for user-defined variables, see
Naming Conventions for User-Defined
Variables in the Using Natural
Studio documentation.
|
SIZE
|
With the Note: Example: Assume a window whose size is defined as
|
SIZE
AUTO
|
The size of the window is determined automatically by Natural at runtime. The size is determined by the data generated into the window as follows:
If you omit the Note: |
SIZE
QUARTER
|
The size of the window will be one quarter of the physical screen. |
SIZE
operand1 * operand2
|
The size of the window will be
If the window is The minimum possible window size is:
The maximum possible window size is the size of the physical screen. |
BASE
|
With the BASE clause, you determine the position
of the window on the physical screen. If you omit the BASE clause,
BASE CURSOR applies by default.
|
BASE
CURSOR
|
Places the top left corner of the window at the current cursor position. The cursor position is the physical position of the cursor on the screen. If the size of the window makes it impossible to place the window at the cursor position, Natural automatically places the window as close as possible to the desired position. |
BASE TOP/BOTTOM
LEFT/RIGHT
|
Places the window at the top-left, bottom-left, top-right, or bottom-right corner respectively of the physical screen. |
BASE
operand3/operand4
|
This places the top left corner of the window at the specified
line/column of the physical screen. The line number is determined by
If the size of the window makes it impossible to place the window at the specified position, you will get an error message. |
REVERSED
|
REVERSED will cause the window to be displayed in
reverse video (if the screen used supports this feature; if it does not,
REVERSED will be ignored).
|
REVERSED CD=
background-color
|
This will cause the window to be displayed in reverse video and the background of the window in the specified color (if the screen used supports these features; if it does not, the respective specification will be ignored). For information on valid color codes, see session parameter
|
TITLE
operand5
|
With the Note: |
CONTROL
|
With the CONTROL clause, you determine whether the
PF-key lines, the message line and the statistics line are displayed in the
window or on the full physical screen.
|
CONTROL
WINDOW
|
CONTROL WINDOW causes the lines to be displayed
inside the window.
If you omit the |
CONTROL
SCREEN
|
CONTROL SCREEN causes the lines to be displayed on
the full physical screen outside the window.
|
FRAMED
|
By default, that is, if you omit the The top and bottom frame lines are cursor-sensitive: where
applicable, you can page forward, backward, left or right within the window by
simply placing the cursor over the appropriate symbol ( Note: |
FRAMED
OFF
|
If you specify FRAMED OFF , the framing and
everything attached to the frame (window title and position information) will
be switched off.
|
FRAMED
(CD=frame-color)
|
This causes the frame of the window to be displayed in the specified color (if the screen used is a color screen; if it is not, the color specification will be ignored). For information on valid color codes, see session parameter
Note: |
position-clause
|
The POSITION clause is only evaluated on mainframe
computers; on all other platforms it is ignored. For details, refer to
Position
Clause below.
|
The POSITION
clause is only evaluated on mainframe
computers; on all other platforms it is ignored.
POSITION
|
SYMBOL
|
TOP
|
[AUTO ]
[SHORT ]
|
LEFT
|
|||||||||
BOTTOM
|
RIGHT
|
||||||||||||
TEXT
|
[MORE ]
|
LEFT
|
|||||||||||
RIGHT
|
|||||||||||||
OFF
|
The POSITION
clause causes information on the position of
the window on the logical page to be displayed in the frame of the window. This
applies only if the logical page is larger than the window; if it is not, the
POSITION
clause will be ignored. The position information
indicates in which directions the logical page extends above, below, to the
left and to the right of the current window.
If the POSITION
clause is omitted, POSITION SYMBOL
TOP RIGHT
applies by default.
Syntax Element Description:
The following rules apply to input fields (with
AD=A
or
AD=M
)
which are not entirely within the window:
Input fields whose beginning is not inside the window are always made protected.
Input fields which begin inside and end outside the window are only
made protected if the values they contain cannot be displayed completely in the
window. Please note that in this case it is decisive whether the value
length, not the field length, exceeds the window size. Filler
characters (as specified with the profile parameter
FC
) do not
count as part of the value.
If you wish to access input fields thus protected, you have to adjust the window size accordingly so that the beginning of the field/end of the value is within the window.
A DEFINE WINDOW
statement must not be placed within a
logical condition statement block. To invoke different windows depending on a
condition, use different SET
WINDOW
statements (or INPUT
statements with a
WINDOW
clause respectively) in a condition.
** Example 'DWDEX1': DEFINE WINDOW ************************************************************************ DEFINE DATA LOCAL 01 #I (P3) END-DEFINE * SET KEY PF1='%W<<' PF2='%W>>' PF4='%W--' PF5='%W++' * DEFINE WINDOW WIND1 SIZE QUARTER BASE TOP RIGHT FRAMED ON POSITION SYMBOL AUTO * SET WINDOW 'WIND1' FOR #I = 1 TO 10 WRITE 25X #I 'THIS IS SOME LONG TEXT' #I END-FOR * END
+------------------------More: + >+ > r ! Page 1 ! All ....+....1....+....2....+....3.. ! ! 0010 ** Example 'DWDEX1': DEFINE WIND ! 1 THIS ! 0020 ******************************** ! 2 THIS ! 0030 DEFINE DATA LOCAL ! 3 THIS ! 0040 01 #I (P3) ! 4 THIS ! 0050 END-DEFINE ! 5 THIS ! 0060 * ! 6 THIS ! 0070 SET KEY PF1='%W<<' PF2='%W>>' PF ! 7 THIS ! 0080 * ! MORE ! 0090 DEFINE WINDOW WIND1 +-------------------------------------+ 0100 SIZE QUARTER 0110 BASE TOP RIGHT 0120 FRAMED ON POSITION SYMBOL AUTO 0130 * 0140 SET WINDOW 'WIND1' 0150 FOR #I = 1 TO 10 0160 WRITE 25X #I 'THIS IS SOME LONG TEXT' #I 0170 END-FOR 0180 * 0190 END 0200 ....+....1....+....2....+....3....+....4....+....5....+... S 19 L 1