Mnemonics
'TEXT' Draw Text
  GUI Display/Printer
   
Format 'TEXT'(x,y[,x,y],text$,attrib$)
 
Where:
attrib$ Optional attribute string. Valid codes include:

 

Code Description
& Underscore the character following the '&' (as in hot keys)
C Center text
F Show focus lines around text
N Numeric data alignment
S Fills only the text background (not whole region) with chosen background colour
W Word wrap
# Same as N
*TEXT
*RTF
*MORE
Special text block printing modes designed to give programmer ability to easily print multiple lines of output to a printer. (see below)

This capability is a +PxPlus Exclusive

text$ String expression.
x,y,x,y Point coordinates for top left and (optionally) bottom right, in graphical units. Numeric expression.
   
Description Use 'TEXT' to draw (print) text in graphics mode, starting at the point set by the first x,y coordinates. Use graphical units or @X(col) and @Y(line) functions for the various coordinates. The 'TEXT' mnemonic uses current 'FONT' and colour attributes (i.e., 'RED', 'BLUE', ...).

Use the optional second set of x,y parameters to define the bottom right corner of a rectangular region for displaying the text. You can use the functions TXH( ), and TXW( ), to make sure the text fits the region.



*Note* For Windows printers, if the current background colour is white, the output will be considered transparent (i.e., with no background fill).


   
Example 0010 PRINT 'FONT'("MS Serif",-11)
0020 PRINT 'GREEN','TEXT'(240,420,"&Hello","&")
   
Block Printing PxPlus provides a special attribute string of "*TEXT" (or "*RTF") to print blocks of text with word wrap to *WINPRT* and *PDF* printed output (PDF output current only support *TEXT, not *RTF).

To use this Block print feature the 'TEXT' mnemonic allows the attribute string to contain "*TEXT" (or "*RTF") as follows:

'TEXT'(x1,y1,x2,y2, "<string>", "*TEXT")
'TEXT'(x1,y1,x2,y2, "<RTF string>", "*RTF")

This would take the string (simple text or RTF) and print it within the bouds of region specified on the printer. If *RTF the current font and colour setting would be ignored, if "*TEXT" the assumption would be Word wrap but use current font, colours, etc.

Should the space required to print the output exceed the size of the region specified, the system will set the internal FIN value of "BYTESLEFT" to a non-zero value indicating how much of the data was not printed. If all the data was printed this value will be set to zero.

By testing the value in BYTESLEFT the application can determine that the output did overflowed the region and can print issue a print with the attribute string of "*MORE". When specifying *MORE, the system will automatically resume printing the text where it left off. In addition the application does not need to send the text string again since the system will have already buffered the output data thus the output text string can be left blank (this will improve system throughput).

For Example assuming that the string COMMENT$ has a long comment to be printed on a document and may potentially require multiple pages to output. The following logic could be used:

Sample using "BYTELEFT" to handle page overflow
  gosub PRINT_HEADER
 ! 
  print (fileno)'text'(@x(10),@y(10),@x(60),@y(40),comment$,"*TEXT"),
 ! 
  while fin(fileno,"BYTESLEFT")<>"0"
  gosub PRINT_FOOTER
  print (fileno)'FF',
  gosub PRINT_HEADER
  print (fileno)'text'(@x(10),@y(10),@x(60),@y(40),"","*MORE"),
  wend 
 ! 
  gosub PRINT_FOOTER

Block printing also returns the actual number of print lines that were used to print the data in the internal FIN value of "TEXTUSEDHEIGHT". This value can be used to determine the exact height of the data printed so that the application can determine where to resume printing at if it want to print below the text.

A typical example of using these two fields would be in an form print program where you may have lines inter-mixed with comments, where the comments may be varying in length RTF text.

Sample Invoice Print routine with variable length RTF comments
  max_line=40
  min_line=10
 !
 NEXT_INVOICE:
  read (inv_file,end=*return)
 !
  gosub PRINT_INV_HDR
  line=min_line
 !
 NEXT_LINE:
  read (inv_line,end=END_INVOICE)
 !
  if line>max_line \
   then gosub PRINT_INV_FOOT;
        gosub PRINT_INV_HDR;
        line=min_line
 !
  print (fileno)'text'(@x(10),@y(line),@x(60),@y(line+1),linedata$),
  line++
 !
  if comment$="" \
   then goto NEXT_LINE
 !
  if line>max_line \
   then gosub PRINT_INV_FOOT;
        gosub PRINT_INV_HDR;
        line=min_line
 !
  print (fileno)'text'(@x(10),@y(line),@x(60),@y(max_line),comment$,"*RTF"),
 !
  while fin(fileno,"BYTESLEFT")<>"0"
  gosub PRINT_INV_FOOT
  gosub PRINT_INV_HDR
  line=min_line
 !
 ! Note we don't resend the comment line - system has it buffered
 !
  print (fileno)'text'(@x(10),@y(line),@x(60),@y(max_line),"","*MORE"),
  wend
 !
  line+=num(fin(fileno,"TEXTUSEDHEIGHT"))
  goto NEXT_LINE
 !
 END_INVOICE:
  gosub PRINT_INV_FOOT
  goto NEXT_INVOICE

Block printing is a +PxPlus Exclusive