Designer: You can set the window border type and attribute with the Designer. You can also change it in your code by calling sw_bdr(), after the window is read in from the Designer library.
Code: You can change the border type and attribute of a window with the set window border function, sw_bdr():
|
||
|
|
|
|
|
|
|
|
|
where bdrp is one of the border types listed in Table 25.1. Appearance of borders is operating system dependent.
Table 25.1: Border Types
| Border Pointer | Type of Border |
| BDR_SLNP | Single-line border |
| BDR_DLNP | Double-line border |
| BDR_SPACEP | Space character border |
| BDR_DOTP | Stippled block graphics character or dot/colon border |
| BDR_STARP | Asterisk border |
| BDR_SOLIDP | Solid block graphics character or space border |
| BDR_NULLP | No border |
If you wish to change the border attribute but not the border type, you can dereference the existing border type from the window structure like this:
|
For att, specify the logical attribute to use for the border. If you do not wish to change the attribute, specify NOCHANGE; the border will be drawn using the existing border attribute, which by default is the window attribute. For Designer windows, specify a logical attribute that is in the logical attribute table for the library. For windows defined in code, specify a logical attribute from the system logical attribute table, or from the logical attribute table attached to the window, if you attached one.
sw_bdr() changes members in the window structure. It does not update the screen. If the window is set on the screen, and you wish to see the changes, call v_bdr() to redisplay the border.
For example, to change the window border to a double-line border displayed with the LHIGHLITE attribute, use the following code statement:
|
To change the window border to a single-line border without changing the attribute, use the following code statement:
|
To change the window border attribute to LREVERSE without changing the border type, use the following code statement:
|
In the following code fragment, an example window is initialized to have a space character border. The window is displayed. The sw_bdr() call changes the border to a double-line border but it is not flushed to the screen. If this window is removed from the screen and later redisplayed, the new double-line border will be used.
|
Note: There are a number of limitations associated with output of block graphics characters different attributes in terminal versions. Block graphics characters are used to draw single- and double-line borders. If you are using a terminal-based version of Vermont Views, see Chapter 54, "Writing Portable Code," for more information on drawing borders and lines using the block graphics attribute.
Caution: Adding or deleting a border changes the size of the window's interior work area. This will affect where the text in the work area is displayed on the screen. If you do not update the window on the screen, you may see strange results when writing to or uncovering that window. If the window is set on the screen, you must do the following:
Changing the size of the interior work area causes additional problems for basic windows, since the size of the memory screen no longer matches the interior work area dimensions. For virtual windows, the change in size is not a problem, since Vermont Views assumes that the work area and the memory screen buffer are not the same size. For a complete description of possible problems and solutions when changing the size of a basic window's work area, see the section "Resizing a Memory Screen," later in this chapter.