TEXTEDIT()

From Recital Documentation Wiki
Jump to: navigation, search

Purpose

Function to edit a text file in a pop-up window


Syntax

TEXTEDIT(<filename>, [<expN1>, <expN2>, <expN3>, <expN4>, <expL1> [,<expC> [,<expL2> [,<expL3>[,<expL4>]]]])


See Also

DB_ADDNEWLINE, FCLOSE(), FGETS(), FOPEN(), FREADSTR(), FWRITE(), HARDCR(), MEMLINES(), MEMOEDIT(), MEMOLINE(), MEMOREAD(), MEMOTRAN(), MEMOWRITE(), MLCOUNT(), MLINE(), SET MEMOWIDTH, SET MEMOWINDOW,


Description

The TEXTEDIT() function allows ASCII text file <filename> to be edited in a pop-up window. It returns .T. if the file was modified and .F. otherwise. Coordinates <row>, <col> to <endrow>, <endcol>, may be optionally specified as <expN1> to <expN4>. If no screen coordinates are specified, TEXTEDIT() will default to the current SET MEMOWINDOW coordinates. If the update parameter <expL1> is .T., then the <filename> can be modified. If <expL1> is .F., then the <filename> can only be viewed. By default, <expL1> is .T..

If the optional <expC> is specified, then the window is bordered and labeled with <expC>. The screen is automatically saved and then restored when SET MEMOCLEAR is ON. If the optional wrap parameter <expL2> is .T. or the [REFORMAT] key is pressed during the editing session, the text is word-wrapped when saved. If the optional <expL3> is .T., then the TEXTEDIT() displays a window in reverse video. Press the [HELP] key to obtain details of the keys that are available during the edit session. If the optional <expL4> is .F. or the environment variable / symbol DB_ADDNEWLINE is set to 'false', additional line feeds will not be automatically added to the text file.

The functions MEMOREAD() and MEMOWRITE() are used for reading text files to and from memo fields. The MEMOLINE() and MLINE() memo editing functions are used to extract a line of text from a memo field. Reading text files into memo fields is strongly recommended for enabling users to edit text files from within applications. Memo files can be edited directly within the same type of window as TEXTEDIT() by using the MEMOEDIT() function. Please note that memo-editing functions will not work with text files, and text-editing functions will not work with memo fields.


Example

// This procedure will 
// be called if the [HELP] key is pressed
procedure helpme
set message to "Hit ^C for help, ^G to exit."
if varread() = "part_des"
    textedit("part_des.txt",5,10,20,70,.F., "Part Description", .F.)
elseif varread() = "name"
    textedit("s_name.txt",5,10,20,70,.F., "Supplier Name", .F.)
else
    dialog box "No help file available."
endif
return


Products

Recital