Output that you write to the window buffer goes into the memory screen and uses the memory screen coordinate system. This may sometimes make it difficult to update only one portion of the virtual window, because you must first determine the coordinates of the location you wish to update.
To make it easier to write to only a portion of the memory screen, you can define a borderless window whose destination is the memory screen. Then you can write to that window and thus the exact place you want to update. You can also use windows to change attributes of different areas of the memory screen.
As an example, the following code defines a one line memory screen and two windows, one which uses the memory screen for a buffer and the other that uses the memory screen as a destination. The long window is intended to be a one-row status line at the bottom of the screen.
|
The window short_wnp is located in the middle of the memory screen. Window short_wnp can be used to write a status message in a defined space of the status window. For example, the following function writes the specified message in the window on the memory screen and updates the long window long_wnp so that it is displayed on the video screen:
|
||
|
|
|
|
|
|
|
||
Using the smaller window ensures that the previous message will be cleared when the clear-to-end-of row option is ON in the window. The row will be cleared to the end of the status message area and no further. If you wrote a string directly to the long window, you would have to turn off the clear-to-end-of-row option to keep from writing over status information at the end of the status line. Instead of using the clear-to-end-of-row option, you would have to pass a string with enough trailing blanks to overwrite any previous messages. In addition, you would have to handle the virtual cursor each time you wrote a string.