[an error occurred while processing this directive]
![]() |
![]() HP OpenVMS Systems Documentation |
![]() |
OpenVMS Programming Concepts Manual
22.4.4 Virtual Displays
You write to virtual displays, which are logically configured as
rectangles, by using the SMG$ routines. The dimensions of a virtual
display are designated vertically as rows and horizontally as columns.
A position in a virtual display is designated by naming a row and a
column. Row and column numbers begin at 1.
Use the SMG$CREATE_VIRTUAL_DISPLAY routine to create a virtual display. SMG$CREATE_VIRTUAL_DISPLAY returns a unique virtual display identification number; use that number to refer to the virtual display. Optionally, you can use the fifth argument of SMG$CREATE_VIRTUAL_DISPLAY to specify one or more of the following video attributes: blinking, bolding, reversing background, and underlining. All characters written to that display will have the specified attribute unless you indicate otherwise when writing text to the display. The following example makes everything written to the display HEADER_VDID appear bold by default:
You can border a virtual display by specifying the fourth argument when you invoke SMG$CREATE_VIRTUAL_DISPLAY. You can label the border with the routine SMG$LABEL_BORDER. If you use a border, you must leave room for it: a border requires two rows and two columns more than the size of the display. The following example places a labeled border around the STATS_VDID display. As pasted, the border occupies rows 2 and 13 and columns 1 and 57.
22.4.4.2 Pasting Virtual DisplaysTo make a virtual display visible, paste it to a pasteboard using the SMG$PASTE_VIRTUAL_DISPLAY routine. You position the virtual display by specifying which row and column of the pasteboard should contain the upper left corner of the display. Example 22-6 defines two virtual displays and pastes them to one pasteboard.
Figure 22-1 shows the screen that results from Example 22-6. Figure 22-1 Defining and Pasting Virtual Displays ![]() You can paste a single display to any number of pasteboards. Any time you change the display, all pasteboards containing the display are automatically updated. A pasteboard can hold any number of virtual displays. You can paste virtual displays over one another to any depth, occluding the displays underneath. The displays underneath are only occluded to the extent that they are covered; that is, the parts not occluded remain visible on the screen. (In Figure 22-2, displays 1 and 2 are partially occluded.) When you unpaste a virtual display that occludes another virtual display, the occluded part of the display underneath becomes visible again. You can find out whether a display is occluded by using the SMG$CHECK_FOR_OCCLUSION routine. The following example pastes a two-row summary display over the last two rows of the statistics display, if the statistics display is not already occluded. If the statistics display is occluded, the example assumes that it is occluded by the summary display and unpastes the summary display, making the last two rows of the statistics display visible again.
22.4.4.3 Rearranging Virtual DisplaysPasted displays can be rearranged by moving or repasting.
You can obtain the pasting order of the virtual displays using
SMG$LIST_PASTING_ORDER. This routine returns the identifiers of all the
virtual displays pasted to a specified pasteboard.
You can remove a virtual display from a pasteboard in a number of different ways:
22.4.4.5 Modifying a Virtual DisplayThe screen management facility provides several routines for modifying the characteristics of an existing virtual display:
The following example uses SMG$CHANGE_VIRTUAL_DISPLAY to change the size of the WHOOPS display to five rows and seven columns and to turn off all of the display's default video attributes. If you decrease the size of a display that is on the screen, any characters in the excess area are removed from the screen.
The following example uses SMG$CHANGE_RENDITION to direct attention to the first 20 columns of the statistics display by setting the reverse video attribute to the complement of the display's default setting for that attribute:
SMG$CHANGE_RENDITION uses three sets of video attributes to determine the attributes to apply to the specified portion of the display: (1) the display's default video attributes, (2) the attributes specified by the rendition-set argument of SMG$CHANGE_RENDITION, and (3) the attributes specified by the rendition-complement argument of SMG$CHANGE_RENDITION. Table 22-2 shows the result of each possible combination.
In the preceding example, the reverse video attribute is set in the rendition-complement argument but not in the rendition-set argument, thus specifying that SMG$CHANGE_RENDITION use the complement of the display's default setting to ensure that the selected portion of the display is easily seen.
Note that the resulting attributes are based on the display's default
attributes, not its current attributes. If you use SMG$ routines that
explicitly set video attributes, the current attributes of the display
may not match its default attributes.
You can create a spawned subprocess directly with an SMG$ routine to allow execution of a DCL command from an application. Only one spawned subprocess is allowed per virtual display. Use the following routines to work with subprocesses:
22.4.5 ViewportsViewports allow you to view different pieces of a virtual display by moving a rectangular area around on the virtual display. Only one viewport is allowed for each virtual display. Once you have associated a viewport with a virtual display, the only part of the virtual display that is viewable is contained in the viewport. The SMG$ routines for working with viewports include the following:
22.4.6 Writing Text to Virtual Display
The SMG$ output routines allow you to write text to displays and to
delete or modify the existing text of a display. Remember that changes
to a virtual display are visible only if the virtual display is pasted
to a pasteboard.
Each virtual display has its own logical cursor position. You can control the position of the cursor in a virtual display with the following routines:
In addition, many routines permit you to specify a starting location other than the current cursor position for the operation. The SMG$RETURN_CURSOR_POS routine returns the row and column of the current cursor position within a virtual display. You do not have to write special code to track the cursor position.
Typically, the physical cursor is at the logical cursor position of the
most recently written-to display. If necessary, you can use the
SMG$SET_PHYSICAL_CURSOR routine to set the physical cursor location.
If you are writing character by character (see Section 22.4.6.3 for line-oriented output), you can use three routines:
These routines are simple and precise. They place exactly the specified characters on the screen, starting at a specified position in a virtual display. Anything currently in the positions written-to is overwritten; no other positions on the screen are affected. Convert numeric data to character data with language I/O statements before invoking SMG$PUT_CHARS. The following example converts an integer to a character string and places it at a designated position in a virtual display:
Note that the converted integer is right-justified from column 4 because the format specification is I4 and the full character string is written. To left-justify a converted number, you must locate the first nonblank character and write a substring starting with that character and ending with the last character.
Inserting and Overwriting Text
To insert characters rather than overwrite the current contents of the screen, use the routine SMG$INSERT_CHARS. Existing characters at the location written to are shifted to the right. Characters pushed out of the display are truncated; no wrapping occurs and the cursor remains at the end of the last character inserted.
Specifying Double-Size Characters
In addition to the preceding routines, you can use SMG$PUT_CHARS_WIDE to write characters to the screen in double width or SMG$PUT_CHARS_HIGHWIDE to write characters to the screen in double height and double width. When you use these routines, you must allot two spaces for each double-width character on the line and two lines for each line of double-height characters. You cannot mix single-and double-size characters on a line.
All the character routines provide rendition-set and
rendition-complement arguments, which allow you to
specify special video attributes for the characters being written.
SMG$PUT_CHARS_MULTI allows you to specify more than one video attribute
at a time. The explanation of the SMG$CHANGE_RENDITION routine in
Section 22.4.4.5 discusses how to use rendition-set and
rendition-complement arguments.
The SMG$PUT_LINE and SMG$PUT_LINE_MULTI routines write lines to virtual displays one line after another. If the display area is full, it is scrolled. You do not have to keep track of which line you are on. All routines permit you to scroll forward (up); SMG$PUT_LINE and SMG$PUT_LINE_MULTI permit you to scroll backward (down) as well. SMG$PUT_LINE permits spacing other than single spacing. Example 22-7 writes lines from a buffer to a display area. The output is scrolled forward if the buffer contains more lines than the display area.
Example 22-8 scrolls the output backward.
To maintain precise control over cursor movement and scrolling, you can write with SMG$PUT_CHARS and scroll explicitly with SMG$SCROLL_DISPLAY_AREA. SMG$PUT_CHARS leaves the cursor after the last character written and does not force scrolling; SMG$SCROLL_DISPLAY_AREA scrolls the current contents of the display forward, backward, or sideways without writing to the display. To restrict the scrolling region to a portion of the display area, use the SMG$SET_DISPLAY_SCROLL_REGION routine.
Inserting and Overwriting Text
To insert text rather than overwrite the current contents of the screen, use the SMG$INSERT_LINE routine. Existing lines are shifted up or down to open space for the new text. If the text is longer than a single line, you can specify whether or not you want the excess characters to be truncated or wrapped. In addition, you can use SMG$PUT_LINE_WIDE to write a line of text to the screen using double-width characters. You must allot two spaces for each double-width character on the line. You cannot mix single- and double-width characters on a line.
Specifying Special Video Attributes
All line routines provide rendition-set and rendition-complement arguments, which allow you to specify special video attributes for the text being written. SMG$PUT_LINE_MULTI allows you to specify more than one video attribute for the text. The explanation of the SMG$CHANGE_RENDITION routine in Section 22.4.4.5 discusses how to use the rendition-set and rendition-complement arguments.
|