[<<Previous Entry]
[^^Up^^]
[Next Entry>>]
[Menu]
[About The Guide]
+---------------------------------+
| TEXT ... ENDTEXT |
+---------------------------------+
TEXT
<text lines>
ENDTEXT
-----------------------------------
Outputs lines of text to current output device(s).
-----------------------------------
<text lines>
Can consist of text, memory variables, expressions, functions, or any
combination. Expressions, functions and memory variables placed within
<text lines> are evaluated only if TEXTMERGE is SET ON and the
expressions, functions and memory variables are enclosed in the
delimiters specified by SET TEXTMERGE DELIMITERS. If TEXTMERGE is SET
OFF, expressions, functions and memory variables are output as literals
along with their delimiters.
TEXT ... ENDTEXT output is sent to the screen or the active window by
default, but can be suppressed within a program with SET CONSOLE OFF.
To send output to a printer or text file, use SET PRINTER TO <printer
name> or SET PRINTER TO <file> followed by SET PRINT ON.
Output from TEXT ... ENDTEXT can be sent to a low-level file created or
opened with FCREATE() or FOPEN(). If a file handle returned by
FCREATE() or FOPEN() is stored to the _TEXT system memory variable,
output is directed to the corresponding low-level file. You cannot
place comments within TEXT and ENDTEXT or after \ or \\ without
outputting the comments also.
+---------------------------------+
| Example |
+---------------------------------+
This example demonstrates the use of the SET TEXTMERGE, SET TEXTMERGE
DELIMITERS and TEXT ... ENDTEXT commands and the _TEXT system memory
variable. A low-level file named HELPINFO.TXT is created and its file
handle is stored in _TEXT. If HELPINFO.TXT can't be created the program
is exited. FOXHELP.DBF is opened and text and information about the
file is output to HELPINFO.TXT. Text and the results of functions are
output to the text file.
A second TEXT ... ENDTEXT is used in a SCAN ... ENDSCAN loop to output
the topics in FOXHELP.DBF. To examine HELPINFO.TXT, issue MODIFY FILE
HELPINFO.TXT in the Command window.
CLEAR
SET TALK OFF
SET TEXTMERGE ON && Allow embedding of expressions and functions
STORE FCREATE('helpinfo.txt') TO _TEXT && Create low-level file
IF _TEXT = -1 && Can't create low-level file then exit program
WAIT WINDOW "Can't create an output file, press a key to exit"
CANCEL
ENDIF
SET HELP OFF
USE C:\FOXPRO\FOXHELP && Open the FoxPro help file
TEXT
HELP FILE INFORMATION
<<DATE()>> <<TIME()>>
Last update: <<LUPDATE()>>
Number of records: <<RECCOUNT()>>
Help file name and location: <<DBF()>>
ENDTEXT
WAIT WINDOW 'Press a key to output topics'
SCAN && Skip through FOXHELP.DBF until end of the file
TEXT
TOPIC: <<TOPIC>>
ENDTEXT
ENDSCAN
CLOSE ALL && close the text file and FOXHELP
SET HELP TO C:\FOXPRO\FOXHELP.DBF && Reset help to FOXHELP.DBF
SET HELP ON
-----------------------------------
See Also: FOPEN(), FCLOSE(), _PRETEXT, SET PRINTER, SET TEXTMERGE,
_TEXT
-----------------------------------
See Also:
FOPEN()
FCLOSE()
SET PRINTER
SET TEXTMERGE
This page created by ng2html v1.05, the Norton guide to HTML conversion utility.
Written by Dave Pearson