Download PDF Vol. II - Software Products Library

Transcript
Run-Time Library Input/Output Operations
22.4 Working with Complex User I/O
22.4.3 Pasteboards
Use the SMG$CREATE_PASTEBOARD routine to create a pasteboard and
associate it with a physical device. SMG$CREATE_PASTEBOARD returns
a unique pasteboard identification number; use that number to refer to the
pasteboard in subsequent calls to SMG$ routines. After associating a pasteboard
with a device, your program references only the pasteboard. The screen
management facility performs all necessary operations between the pasteboard
and the physical device. Example 22–4 creates a pasteboard.
Example 22–4 Creating a Pasteboard
STATUS = SMG$CREATE_PASTEBOARD (PBID, ROWS, COLUMNS)
IF (.NOT. STATUS) CALL LIB$SIGNAL (%VAL (STATUS))
22.4.3.1 Erasing a Pasteboard
When you create a pasteboard, the screen management facility clears the screen
by default. To clear the screen yourself, invoke the SMG$ERASE_PASTEBOARD
routine. Any virtual displays associated with the pasteboard are removed from
the screen, but their contents in memory are not affected. The following example
erases the screen:
STATUS = SMG$ERASE_PASTEBOARD (PBID)
IF (.NOT. STATUS) CALL LIB$SIGNAL (%VAL (STATUS))
22.4.3.2 Deleting a Pasteboard
Invoking the SMG$DELETE_PASTEBOARD routine deletes a pasteboard,
making the screen unavailable for further pasting. The optional second argument
of the SMG$DELETE_PASTEBOARD routine allows you to indicate whether the
routine clears the screen (the default) or leaves it as is. The following example
deletes a pasteboard and clears the screen:
STATUS = SMG$DELETE_PASTEBOARD (PBID)
IF (.NOT. STATUS) CALL LIB$SIGNAL (%VAL (STATUS))
By default, the screen is erased when you create a pasteboard. Generally, you
should erase the screen at the end of a session.
22.4.3.3 Setting Screen Dimensions and Background Color
The SMG$CHANGE_PBD_CHARACTERISTICS routine sets the dimensions of
the screen and its background color. You can also use this routine to retrieve
dimensions and background color. To get more detailed information about the
physical device, use the SMG$GET_PASTEBOARD_ATTRIBUTES routine.
Example 22–5 changes the screen width to 132 and the background to white,
then restores the original width and background before exiting.
Example 22–5 Modifying Screen Dimensions and Background Color
.
.
.
INTEGER*4 WIDTH,
2
COLOR
INCLUDE ’($SMGDEF)’
(continued on next page)
22–10 Run-Time Library Input/Output Operations