Adding Horizontal or Vertical Lines to a Data Form

Horizontal and vertical lines can be used to separate rows and columns of data fields.

Designer: Lines can be added to your form in the Designer. See the Designer User's Guide for more information.

Code: To define a line for a data form, use the background line definition function, bg_linedef():

BG_LINEPTR bg_linedef(wn_rb, wn_cb, length, dir, att, ln_stylep, dfmp)
 
int wn_rb;
/* Form row to begin drawing line
*/
int wn_cb;
/* Column to begin drawing line
*/
int length;
/* Length of line in spaces
*/
int dir;
/* Direction, optionally ORed with X_LINE
*/
UCHAR att;
/* Video attribute to use 
*/
LINEPTR ln_stylep;
/* Style to use for line
*/
DFORMPTR dfmp;
/* Pointer to form
*/

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 (length), 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, use the direction ORed 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 15.3.

Table 15.3: Line Types

Line Style Type of Line
LINE_SLNP Single-line graphics character
LINE_DLNP Double-line graphics character
LINE_SPACEP Space character
LINE_DOTP Stippled block graphics character or dot/colon border
LINE_STARP Asterisks
LINE_SOLIDP Solid block graphics 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.


Home Contents Previous Next