OPEN WINDOW statement is used to create a 4GL window.
Window name |
The name you want to assign to the new window |
AT |
An optional clause which specifies the position of the window |
Window size |
The clause which specifies the size of the window |
WITH FORM |
The clause which specifies which form you want to open in the window |
Display attributes applied to the window |
OPEN window creates but doesn't display the window.
You should use other means to make the new window visible.
The easiest way to make a new window visible is the ui.Window.SetVisible method right after the OPEN WINDOW statement.
MAIN
DEFINE l_maxvalue INT
DEFINE l_pb ui.ProgressBar
DEFINE i SMALLINT
DEFINE w ui.Window
LET l_maxvalue=5
CALL fgl_getkey()
OPEN WINDOW w1 WITH FORM 'progressbar_refresh' ATTRIBUTE(BORDER)
LET w = ui.Window.forname("w1")
CALL w.SetVisible(TRUE)
LET l_pb = ui.ProgressBar.forName("pb01")
CALL l_pb.SetMinValue(0)
CALL l_pb.SetMaxValue(l_maxvalue)
FOR i = 1 to l_maxvalue
CALL l_pb.SetCurrentValue(i)
SLEEP 1
END FOR
CALL fgl_getkey()
END MAIN
A 4GL window is an area on the screen where the associated menu, messages, errors, and screen forms are displayed. The OPEN WINDOW statement can include the information that specifies:
The window-name must be unique among the other window names within the program.
Every 4gl program must include some user interactions.
If your 4gl program doesn't have any user interactions, then at runtime
if the application has two and more windows opened at once, only the current window will have visible content, whereas other windows will seem to be empty because their content will be invisible and will become visible only after any user interaction.
This is what it would look like (obtained with the example program below):