W_AREA
Manipulate the processing and display areas
WTSupported in traditional Synergy on Windows
|
WNSupported in Synergy .NET on Windows
|
USupported on UNIX
|
VSupported on OpenVMS
|
xcall W_AREA(id, function, arguments[, function, arguments][, ...])
Arguments
id
A variable that contains the window ID. The ID must be the same one that was returned by the WP_CREATE function (see WP_CREATE). (n)
function
One or more of the following functions:
WA_ATTR = Alter the processing area’s attributes.
WA_BOX = Draw a box within the processing area.
WA_CHANGE = Change the size and position of the processing area relative to the current values.
WA_COLOR = Set the color of the processing area.
WA_COPY = Copy parameters to or from the display or processing area settings.
WA_CORNER = Position the current window to one corner of the processing area.
WA_FILL = Fill the processing area with characters.
WA_INSERT = Insert a line at the top or bottom of the scrolling area.
WA_SCROLL = Scroll the contents of the processing area.
WA_SET = Set the size and position of the processing area.
arguments
(optional) Any arguments used by the specified function.
Discussion
W_AREA is used to modify the size, position, and contents of a window’s processing and display areas. The initial default processing and display areas are the same size as the window.
If you use ^VARARGARRAY, id is the last declared argument for this routine.
WA_ATTR, attributes
WA_ATTR alters the attributes of the processing area’s contents. See Attributes for a description of the standard window attributes.
In this example, we fill the processing area with letters. Then we set the processing area so its upper-left corner is at position (3,5) within the window and its dimensions are 6 rows by 14 columns. The WA_BOX function draws a box around the area. Note that the line-drawing characters are part of the area, which means that if we want to change the attributes of the area’s contents without changing the attributes of the box, we must shrink the area. The WA_CHANGE function moves the upper-left corner of the area by 1 row and 1 column and reduces the horizontal and vertical dimensions by 2. We also change the area’s attributes to reverse video.
.define MAXWINS, 15 .define WNDCHNL, 1 .include "WND:windows.def" record wndw_1 ,i4 proc open(WNDCHNL, o, "tt:") xcall w_init(0, WNDCHNL, MAXWINS) xcall w_proc(WP_CREATE, wndw_1, "window1", 10, 22) xcall w_area(wndw_1, WA_FILL, "abcdefghijklmnopqrstuvw") xcall w_proc(WP_PLACE, wndw_1, 11, 28) xcall w_area(wndw_1, WA_SET, 3, 5, 6, 14, WA_BOX, WA_CHANGE, 1, 1, -2, -2) call pause xcall w_area(wndw_1, WA_ATTR, ATTR_SET + ATTR_RVRS) call pause xcall w_exit stop pause, xcall w_updt sleep 1 return end
WA_BOX
WA_BOX draws a box at the edge of the processing area. The line-drawing characters of the box are included in the area; they are not outside the area.
In the routine below, we set an area and draw a box around it before setting the next area and boxing it. Notice that we can overlap areas.
.define MAXWINS, 15 .define WNDCHNL, 1 .include "WND:windows.def" record wndw_1 ,i4 proc open(WNDCHNL, o, "tt:") xcall w_init(0, WNDCHNL, MAXWINS) xcall w_proc(WP_CREATE, wndw_1, "window1", 16, 40, & WP_PLACE, wndw_1, 8, 20) xcall w_area(wndw_1, WA_SET, 1, 1, 8, 20, WA_BOX) xcall w_area(wndw_1, WA_SET, 1, 21, 8, 20, WA_BOX) xcall w_area(wndw_1, WA_SET, 9, 1, 8, 20, WA_BOX) xcall w_area(wndw_1, WA_SET, 9, 21, 8, 20, WA_BOX) xcall w_area(wndw_1, WA_SET, 5, 11, 8, 20, WA_BOX) xcall w_exit stop end
WA_CHANGE, row_change, col_change, height_change, width_change
WA_CHANGE makes relative changes to the size of the processing area. Row_change, col_change, height_change, and width_change are numeric expressions that are added to the row, column, height, and width values of the current processing area. If the resulting area doesn’t lie entirely within the window, it is automatically limited so that it does fit inside the window.
The program below fills the entire area with asterisks, then sets the area to a smaller area and boxes it. WA_CHANGE sets a new area that doesn’t retain the attributes of the previous area.
.define MAXWINS, 15 .define WNDCHNL, 1 .include "WND:windows.def" record wndw_1 ,i4 proc open(WNDCHNL, o, "tt:") xcall w_init(0, WNDCHNL, MAXWINS) xcall w_proc(WP_CREATE, wndw_1, "window1", 10, 22) xcall w_area(wndw_1, WA_FILL, "*") xcall w_proc(WP_PLACE, wndw_1, 11, 28) xcall w_area(wndw_1, WA_SET, 3, 5, 6, 14, WA_BOX) call pause xcall w_area(wndw_1, WA_CHANGE, 1, 1, -2, -2, WA_FILL, " ") call pause xcall w_exit stop pause, xcall w_updt sleep 1 return end
WA_COLOR, color
WA_COLOR resets the color for the processing area to color, which is a numeric expression that specifies a palette number between 1 and 16. See Colors and the color palette for more information about color.
The following routine fills a window with asterisks, then resets the processing area and boxes it. The WA_COLOR function changes the color from the default color to the background and character colors specified in palette number 2.
.define MAXWINS, 15 .define WNDCHNL, 1 .include "WND:windows.def" record wndw_1 ,i4 proc open(WNDCHNL, o, "tt:") xcall w_init(0, WNDCHNL, MAXWINS) xcall w_proc(WP_PALET, 2, 1, 3) xcall w_proc(WP_CREATE, wndw_1, "window1", 10, 22) xcall w_area(wndw_1, WA_FILL, "*") xcall w_proc(WP_PLACE, wndw_1, 11, 28) xcall w_area(wndw_1, WA_SET, 3, 5, 6, 14, WA_BOX) call pause xcall w_area(wndw_1, WA_COLOR, 2) call pause xcall w_exit stop pause, xcall w_updt sleep 1 return end
WA_COPY, option
WA_COPY copies parameters to or from the row, column, height, and width settings of the display or processing area, where option is one of the following:
WAC_WTOP |
Copy window area size settings to the processing area settings. |
WAC_DTOP |
Copy display area size settings to the processing area settings. |
WAC_WTOD |
Copy window area size settings to the display area settings. |
WAC_PTOD |
Copy processing area size settings to the display area settings. |
This function doesn’t copy one area’s data or attributes to another area, only the size and placement settings. For example, if we use the option WAC_PTOD, the processing area’s settings are copied to the display area’s settings, which means that the display area is changed so that it is the same size and in the same position as the processing area. The option WAC_WTOP copies the window area’s settings to the processing area, which means that the processing area becomes the same size and is placed in the same position as the window area.
In the example below, we split the window into four quadrants plus a center section and fill each area with numbers. Then we put a second window behind the first window and fill it with asterisks. (To put the second window behind the first placed window, we place the second window first.)
Next, we set a processing area of 8 rows by 20 columns and use the option WAC_PTOD to copy those settings to the display area. The effect of this option is that the display area shrinks to the size of the processing area, and consequently, the area displays only one quadrant, plus the “overlapping” number 5s. We repeat this function, setting the display area to be equal to the different processing areas.
At the end of the program, we use the WAC_WTOD option, which copies the window area’s settings to the display area. This action enlarges the display area to its original size so that all of wndw_1 is displayed again.
.define MAXWINS, 15 .define WNDCHNL, 1 .include "WND:windows.def" record wndw_1 ,i4 wndw_2 ,i4 proc open(WNDCHNL, o, "tt:") xcall w_init(0, WNDCHNL, MAXWINS) xcall w_proc(WP_CREATE, wndw_1, "window1", 16, 40) xcall w_area(wndw_1, WA_SET, 1, 1, 8, 20, & WA_FILL, "1", WA_SET, 1, 21, 8, 20, & WA_FILL, "2", WA_SET, 9, 1, 8, 20, & WA_FILL, "3", WA_SET, 9, 21, 8, 20, & WA_FILL, "4", WA_SET, 5, 11, 8, 20, & WA_FILL, "5") xcall w_proc(WP_CREATE, wndw_2, "window2", 20, 44) xcall w_area(wndw_2, WA_FILL, "*") xcall w_proc(WP_PLACE, wndw_2, 4, 36, WP_PLACE, wndw_1, 6, 38) call pause xcall w_area(wndw_1, WA_SET, 1, 1, 8, 20, WA_COPY, WAC_PTOD) call pause xcall w_area(wndw_1, WA_SET, 1, 21, 8, 20, WA_COPY, WAC_PTOD) call pause xcall w_area(wndw_1, WA_SET, 9, 1, 8, 20, WA_COPY, WAC_PTOD) call pause xcall w_area(wndw_1, WA_COPY, WAC_WTOD) call pause xcall w_exit stop pause, xcall w_updt sleep 1 return end
WA_CORNER, option
WA_CORNER moves the current window position to one of the processing area’s corners. This feature is useful, for example, if you want to add text to the top of the processing area. You could specify that you want to add text beginning at the upper-left corner, without having to know the exact row and column position within that processing area.
Option is one of the following:
WAC_ULC |
Position to upper left. |
WAC_URC |
Position to upper right. |
WAC_LLC |
Position to lower left. |
WAC_LRC |
Position to lower right. |
In the following routine, we create a window and fill it with asterisks. Then we set a smaller processing area and box it. To fill the processing area with another character without wiping out the box, we need to change the processing area and then fill it. Next, we use the WA_CORNER function to position the current window position to the upper-left corner and then the upper-right corner before displaying text. Notice that when you position to the upper-right corner and want to display text, you must move the display position backwards (in this case, eight columns back) to accommodate the text.
.define MAXWINS, 15 .define WNDCHNL, 1 .include "WND:windows.def" record wndw_1 ,i4 proc open(WNDCHNL, o, "tt:") xcall w_init(0, WNDCHNL, MAXWINS) xcall w_proc(WP_CREATE, wndw_1, "window1", 11, 51) xcall w_area(wndw_1, WA_FILL, "*") xcall w_proc(WP_PLACE, wndw_1, 12, 12) xcall w_area(wndw_1, WA_SET, 3, 10, 7, 35, WA_BOX, & WA_CHANGE, 1, 1, -2, -2, WA_FILL, " ", & WA_CORNER, WAC_ULC) xcall w_disp(wndw_1, "top left") xcall w_updt xcall w_area(wndw_1, WA_CORNER, WAC_URC) xcall w_disp(wndw_1, WD_MOVE, 0, -8, "top right") xcall w_exit stop end
WA_FILL, alpha_string
WA_FILL fills the processing area with a string of characters specified by alpha_string. To clear a processing area, use a blank character as the alpha_string (WA_FILL, “ ”). The characters are written using the window’s current default attributes.
In the following example, we set a processing area and fill it before setting a new processing area and filling it. When we’re done, we clear the processing area that was set.
.define MAXWINS, 15 .define WNDCHNL, 1 .include "WND:windows.def" record wndw_1 ,i4 proc open(WNDCHNL, o, "tt:") xcall w_init(0, WNDCHNL, MAXWINS) xcall w_proc(WP_CREATE, wndw_1, "window1", 16, 40) xcall w_proc(WP_PLACE, wndw_1, 8, 20) xcall w_area(wndw_1, WA_SET, 1, 1, 8, 20, & WA_FILL, "1", WA_SET, 1, 21, 8, 20, & WA_FILL, "2", WA_SET, 9, 1, 8, 20, & WA_FILL, "3", WA_SET, 9, 21, 8, 20, & WA_FILL, "4", WA_SET, 5, 11, 8, 20, & WA_FILL, "5") xcall w_updt sleep 1 xcall w_area(wndw_1, WA_FILL, " ") xcall w_exit stop end
WA_INSERT, placement, line
WA_INSERT scrolls the processing area up or down one line and inserts a line at the bottom or top of the scrolling area, where placement is one of the following:
WAI_TOP |
Insert a line at the top of the scrolling area. |
WAI_BOTTOM |
Insert a line at the bottom of the scrolling area. |
Line is an alpha expression whose value is inserted in the scrolling area.
Hardware scrolling only occurs when the WA_INSERT or WA_SCROLL functions are used. Both of these commands do an implicit screen update when hardware scrolling is active.
WA_SCROLL, direction, count
WA_SCROLL scrolls the contents of the processing area. Direction defines the direction of the text’s movement relative to the window, and the value of count indicates how many rows or columns to scroll. When you scroll up or down, count represents the number of rows. When you scroll left or right, count represents the number of columns.
The direction options are listed below:
WAS_UP |
Scroll from bottom to top. |
WAS_DOWN |
Scroll from top to bottom. |
WAS_LEFT |
Scroll from right to left. |
WAS_RIGHT |
Scroll from left to right. |
Hardware scrolling only occurs when the WA_INSERT or WA_SCROLL functions are used. Both of these commands do an implicit screen update when hardware scrolling is active.
For non-VT-type terminals on UNIX, the termcap/terminfo bases are accessed for the sequences to set the scrolling region and scroll up or scroll down. If these sequences are not present, hardware scrolling is not enabled. |
In the example below, we use hardware scrolling to scroll an area within an area. Note that after the last WA_SCROLL function, when we’ve returned to the original position, we “lose” the characters that have scrolled out of the area.
.define MAXWINS, 15 .define WNDCHNL, 1 .include "WND:windows.def" record wndw_1 ,i4 proc open(WNDCHNL, o, "tt:") xcall w_init(0, WNDCHNL, MAXWINS) xcall w_proc(WP_CREATE, wndw_1, "window1", 16, 40) xcall w_area(wndw_1, WA_FILL, "1234567890") xcall w_proc(WP_PLACE, wndw_1, 8, 20) call pause xcall w_area(wndw_1, WA_SCROLL, WAS_UP, 3) call pause xcall w_area(wndw_1, WA_SCROLL, WAS_DOWN, 6) call pause xcall w_area(wndw_1, WA_SCROLL, WAS_UP, 3) call pause xcall w_exit stop pause, xcall w_updt sleep 1 return end
WA_SET, row, column, height, width
WA_SET defines the processing area. Row, column, height, width are numeric expressions that define the position and size of the processing area. The resulting area must lie entirely within the window; if the area you define exceeds the bounds of the window, the system corrects for it by moving the area or truncating it.
You can have only one processing area at a time. If, for example, you want to set five different processing areas and fill them with different characters, as we do in the example for the function WA_FILL, you must set the first processing area and fill it before resetting the processing area.
See the example for WA_FILL, which sets several processing areas.