These pages refer to legacy Hydra and Lycia 1 features. The functionality described here does not embrace all the functionality provided by Lycia 3. If you use Lycia 3, please, turn to other sections of this online documentation.
fgl_drawbox() displays a rectangle of a specified size.
It takes comma-separated arguments for the height, width, line, left-offset and may also take color.
fgl_drawbox() draws a rectangle with the upper-left corner at (line, left-offset) with the dimensions specified by the height and width values. These dimensions must have positive integer values, in units of lines and character positions, where (1,1) is the upper-left corner of the current 4GL window.
color |
an integer expression that returns a positive whole number, specifying a foreground color code. In practice, foreground color means the color of the border. |
height |
an integer expression; it defines the unit height of the rectangle measured in screen lines |
left-offset |
an integer expression; it defines the horizontal distance of the top left-hand corner of the rectangle, measured in characters, from the left-hand edge of the screen where the first character is located |
line |
an integer expression; it defines the vertical distance of the top left-hand corner of the rectangle, measured in screen lines, from the upper edge of the screen, where the first screen line is |
width |
an integer expression; it defines the width of the outline of the rectangle, measured in characters |
The optional color number must correspond to one of the following foreground colors:
color number |
foreground color |
0 |
WHITE |
1 |
YELLOW |
2 |
MAGENTA |
3 |
RED |
4 |
CYAN |
5 |
GREEN |
6 |
BLUE |
7 |
BLACK |
The upscol utility can specify these same color options in the syscolatt table. The default color is used when the color number is omitted. The color argument is optional.
As is the case with borders, the width of the line that draws the rectangle is fixed. This fixed width cannot be specified or modified when you invoke fgl_drawbox( ). As with borders, 4GL draws the box with the characters defined in the termcap or terminfo files. You can specify alternative characters in these files. Otherwise, 4GL uses hyphens to create horizontal lines, pipe symbols (|) for vertical lines, and plus signs at the corners. To assign the box a colour, you must use termcap because terminfo does not support colour. The termcap and terminfo files are discussed in detail in the Appendix: "Modifying termcap and terminfo."
For example:
MAIN
DEFINE inp_char CHAR(1)
OPTIONS PROMPT LINE 24
DISPLAY "***** FGL_DRAWBOX() Function example *****" AT 1,5
CALL fgl_drawbox(10, 60, 3, 2)
DISPLAY "This is a fgl_drawbox with the arguments" at 8,5
DISPLAY "fgl_drawbox(10,60,3,2)" at 9,5
DISPLAY "Height = 10 Lines, Width = 60 Columns" at 10,5
DISPLAY "on Line 3, Column 2" at 11,5
CALL fgl_drawbox(10,60,14,2,3)
DISPLAY "This is a fgl_drawbox with the arguments" at 16,5
DISPLAY "fgl_drawbox(10,60,14,2,3)" at 17,5
DISPLAY "Height = 10 Lines, Width = 60 Columns" at 18,5
DISPLAY "on Line 14, Column 2, with the color 3, which is red" at 19,5
PROMPT "Press any key to close this demo application" FOR inp_char
END MAIN
Rectangles drawn by fgl_drawbox() are part of a displayed form. Each time that you execute the corresponding DISPLAY FORM or OPEN WINDOW ... WITH FORM statement, you must also redraw the rectangle.
If you invoke fgl_drawbox() several times to create a display in which rectangles intersect, output from the most recent function call overlies any previously drawn rectangles. Screen fields and reserved lines, however, have a higher display priority than fgl_drawbox() rectangles, regardless of the order in which the fields, lines, and rectangles are drawn.
In most applications, avoid drawing rectangles that intersect or overlap any field or reserved line.
Reserved lines might be redrawn frequently during user interaction statements, partially erasing any rectangles at the intersections where they overlap the reserved lines.
To avoid this problem, use the elementBorder form property. If you still require to use fgl_drawbox(), position rectangles so they do not overlap any reserved lines or screen fields.