Last Revised: 10/25/16 |
The purpose of this routine is to read, print, import, or convert window text. Window text, also called Notepad by most applications, is created using CDS069 with a type of W, but it can also be created or appended to using this called program.
Window text may be stored in an SKY or MKY file. The key structure is a text identifier followed by a U(1) record number starting at zero. The characters per record can be any convenient size, typically 128, 256, 512, 1024, etc. Since only 256 records can be stored per text id, the characters per record determine the maximum notepad size. Note that the characters per record are not in any way related to the width of the entry window.
When this routine is called from application programs, it is usually used to print window text that has been previously entered. This routine will optionally print the window border as well as the text contained within the border.
See also CDS261 Return Window Text, and CDS054 Window Text - Copy/Delete.
When used to print window text, the format is:
CALL "CDS257", Y$, TEXTID$, TITLE$,
FILECHAN$, STS$, INDENT, 0, 0, 0,
Y6$, Y5$, Y5A$,
INDENT$
In its most complete form, CDS257 is called using the following variables:
CALL "CDS257", Y$, TEXTID$, TITLE$,
FILECHAN$, STS$,
COLS, ROWS, XPOS, YPOS, ATTRB$, ATTRW$, WT$, WA$,
IMPORT$
CDS257 | ||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Y$
|
In/Out | Session Control Variable | ||||||||||||||||||
TEXTID$
|
In | Text ID, such as a customer#, vendor#, item#, etc. | ||||||||||||||||||
TITLE$
|
In | title string to be used if the window is to be printed | ||||||||||||||||||
FILECHAN$
|
In | text file name or STR(channel#) if pre-opened by calling routine |
||||||||||||||||||
STS$(1,1)
|
In |
Action Code. Only Action Codes P, T and W are typically needed by
application programs.
|
||||||||||||||||||
STS$(2,1)
|
In |
Print window border. This applies only when STS$(1,1)="P"
and the target printer supports standard box drawing characters.
|
||||||||||||||||||
STS$(3,1)
|
In |
Print headings on new page after page break. Only applies when
STS$(1,1)="P" . |
||||||||||||||||||
STS$(4,1)
|
In |
Print in 8 lines per inch. Only applies when STS$(1,1)="P" . |
||||||||||||||||||
COLS
|
In/Out | window width (data only, not border). Defaults to 78 if passed
as zero. When reading existing notepad text, and COLS is passed as
non-zero, and COLS is passed as a value lower then when window text was
originally saved, then COLS will be returned with the value used when
the text was originally saved. |
||||||||||||||||||
ROWS
|
In | window height (data only, not border). If passed as zero, ROWS
will be computed to the maximum size possible, excluding top two lines
of display.
|
||||||||||||||||||
XPOS
|
In | starting column position of the window. | ||||||||||||||||||
YPOS
|
In | starting row position of the window | ||||||||||||||||||
ATTRB$
|
In | Optional attributes containing mnemonics when displaying window
border. Typically includes text and cell background colors such as
'SF+'CYAN'+'BACKGR'+'BLACK' . Default value is a 'WHITE' border on
the current cell background color. |
||||||||||||||||||
ATTRW$
|
In | Optional attributes containing mnemonics when displaying the window
text such as 'YELLOW'+'BACKGR'+'RED' . Default value is
'WHITE'
text on the current cell background color. |
||||||||||||||||||
WT$
|
In/Out | Window text. Output when STS$(1,1)="T" . WT$ consists of ROWS rows of COLS characters per row. So if
ROWS=3 and COLS=60 , WT$ will be 180 characters long, with
line 1 at WT$(1,60) , line 2 at WT$(61,60) and
line 3 at WT$(121,60) . |
||||||||||||||||||
WA$
|
In/Out | Window text attributes. Same length as WT$ with bbx
attribute bits set for each character. Not typically needed by
application software. |
||||||||||||||||||
IMPORT$
|
In | Used when converting text to window text when STS$(1,1)="W" .
IMPORT$ can also contain the mnemonics 'LF' to advance to
the next line, 'BU' & 'EU' to begin and end underlining, 'SF & 'SB' to
make text bold and dim, 'BR' & 'ER' to begin and end reverse video,
'BB'
& 'EB' to begin and end blinking text, column positioning expressions
@(COL) , and combination attributes using 'ATTR' . See example
below. |
||||||||||||||||||
INDENT
|
In | number of positions to indent window from left edge. If set to -1, then the window text will be centered on the page | ||||||||||||||||||
INDENT$
|
In |
When passing INDENT as a positive number, you may
optionally pass INDENT$ which will be printed at the left
edge of the page. It can be up to INDENT-1 characters
long and will print on the first line of notepad text. It is
typically used to print the notepad date or other segment in the notepad
TEXTID$ . |
||||||||||||||||||
Y6$
|
In/Out |
the printer control variable returned from printer selection routine
CDS084. Note, that Earlier versions of this program passed |
||||||||||||||||||
Y5$
|
In | optional report heading to print centered under company name | ||||||||||||||||||
Y5A$
|
In | optional second line of report heading, printed under Y5$ |
When printing, note that CDS257 will not print anything if there is no text for the specified text ID. No error message will be displayed. This eliminates the need for the application program to test and see if there is any text on file before calling CDS257. Only the number of lines with actual text will be printed, i.e., any trailing blank lines in the window will not be printed.
Printing example: used during Purchase Order printing to print the company Terms & Conditions stored in file XXPO43 with a message ID of "STANDARD_NOTEPAD". PO00.STDNOTEPAD contains the total number of lines of notepad text. |
1380 IF PO00.STDNOTEPAD THEN LET MSGID$="STANDARD_NOTEPAD",LINES=PO00.STDNOTEPAD,
INDENT=0; GOSUB NOTEPAD
|
When importing text, the user will be prompted when there are invalid
characters in the text to be imported. Notepad text can contain ASCII
characters, bbx mnemonics and cursor positioning expressions, carriage
return, and line feed characters. Other characters including letters
displayed with diacritical marks are considered invalid. Invalid
characters are replaced with blanks. In these cases you may want to
edit the notepad text using CDS069, replacing the invalid character that was
replaced with a blank, with the plain letter. You can suppress the
operator prompt warning about invalid characters by setting global variable
"SMS_CDS258_MSG"
to "N"
. Note that all
invalid characters will be replaced with a blank, regardless of the prompt.
Importing text will replace any existing text with same Text ID. You can however, import text into a temporary file or Text ID, then use CDS054 to append imported text to end of existing text. Then you can use CDS054 to delete text from temporary location, or if imported into a temporary file, just erase the temporary file using CDS075.
Importing example: used to convert some plain text to notepad text |
1000 EXAMPLE:
|
Text example: used to retrieve notepad text excluding all attributes. |
1200 EXAMPLE:
|