Horizontal and vertical lines can be used to separate rows and columns of menu fields.
Designer: You can add lines to your menu in the Designer. See the Designer User's Guide for more information.
Code: To define a line for a menu form, use the background line definition function, bg_linedef():
|
||
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
In the call, you specify the window coordinates where you want the line to begin (wn_rb and wn_cb), the length you want the line to extend (len), and the attribute to use to draw the line (att).
For the direction of the line (dir), specify the direction you want the line to be drawn from its origin—UP, DOWN, LEFT, or RIGHT. If you specify UP, DOWN, LEFT or RIGHT, the function simply draws the line characters in the window. It does not draw intersection characters.
You can control whether lines use the proper intersection character when intersecting with other lines. If you want the function to draw intersection characters if the line overwrites a box or another line, OR the direction with X_LINE (e.g., UP | X_LINE). On terminal-based systems, lines will use the proper intersection character only when two lines of the same type intersect. If you are operating under PCDOS or OS/2, lines will always use the proper intersection characters.
Define lines that should not use the intersection characters when intersecting other lines last, or after all lines that do use the intersection characters. Intersection characters are used only if the line is a single- or double-line.
Specify the style of the line (ln_stylep) to be one of the line styles listed in Table 21.3. Appearance of lines is operating system dependent.
Table 21.3: Line Styles
| Line Style | Description |
| LINE_SLNP | Single-line graphics character |
| LINE_DLNP | Double-line graphics character |
| LINE_SPACEP | Space character |
| LINE_DOTP | Stippled block graphic character or periods |
| LINE_STARP | Asterisks |
| LINE_SOLIDP | Solid block graphic character or spaces |
There are a number of limitations associated with output of block graphics characters in terminal versions. See Chapter 54, "Writing Portable Code," for more information on border-drawing, line-drawing and the block graphics attribute if you are using a terminal-based version of Vermont Views.
General: Drawing lines while observing the intersection of lines is slower than simply drawing a line with UP, DOWN, LEFT, or RIGHT. To draw intersecting lines, the function looks at each character it is overwriting. If the character is a graphics character, the appropriate intersecting graphic character will be used instead of the line character. To speed your program, only use intersecting line drawing when necessary.
The following code fragment defines a menu with four fields. The first two fields are separated from the last two fields by a horizontal line.
|
The menu form defined by this code fragment is shown in Figure 21.1.

Figure 21.1: Menu Form with Lines