SUB.EDIT
Published By | Date | Version | Knowledge Level | Keywords |
---|---|---|---|---|
Revelation Technologies | 14 NOV 1989 | 2.X | EXPERT | SUB.EDIT |
SUB.EDIT is used to edit records. Single or multiple lines of text may be edited within a specified area of the screen.
SUB.EDIT(file, key, title, null, inval, protect, exit.key, except.key, col, row, displen, color, flags, change, lines, exit, inpat, outpat, just, delim, mask, linelen, state)
Using SUB.EDIT
The edit environment is highly configurable and may be saved and restored. SUB.EDIT differs from the system subroutine SCRIBE only in the first four arguments (SCRIBE does not use them), reflecting its record editing function.
file
Use file to pass the name of the source file
key
Use key to pass the key of the record to be edited. Multiple records may be edited, the keys delimited by @VM.
title
Use title to pass the text to be displayed as the title of the edit window
null
This parameter is reserved for system use and should be null.
inval
Use inval to pass the data to be displayed and edited. SUB.EDIT also returns the edited data here. In multiline mode (lines is greater than 1), the lines of text returned in inval will be delimited by the character specified in delim.
protect
If true, this flag prohibits the editing of inval data. A system message will be generated if editing is attempted. Protect defaults to false.
exit.key
Use exit.key to pass the key or key sequence which will exit SUB.EDIT whenever editing is enabled. Multiple values for exit.key must be separated by | or @FM. In addition, exiting will occur under the following conditions:
- [ <F128M>ì<F255D> ] is pressed at the top of an edit window, or [ <F128M>Å<F255D> ] at the bottom.
- [Enter] is pressed and lines is 0 (single line edit)
except.key
Use except.key to pass the key or key sequence that will exit SUB.EDIT whenever editing is disabled. Multiple except.keys must be separated by | or @FM. In addition, exiting will occur if [<F128M> ì<F255D> ] is pressed at the top of an edit window, or [<F128M> Å<F255D> ] at the bottom.
col
Use col to pass the starting display column of the edit environment.
row
Use row to pass the top display row of the edit environment.
displen
Use displen to pass the display length in columns of the edit environment. Displen must be specified. If the length of the text entered exceeds displen, the text is horizontally scrolled.
color
Use color to pass an array of Advanced Revelation escape sequences indicating the video attributes for the edit window. The attributes default to the settings in @ENVIRON.SET (see Appendix 1, "System Variables" and Appendix 3, "Video Attributes"). The following color fields may be set:
Field | Description |
---|---|
<1> | An escape sequence setting the video attributes of all text displayed. |
<2> | An escape sequence setting the video attributes for any defined block of text. |
<3> | An escape sequence setting the video attributes for text at the current line. |
flags
Use flags to pass a dynamic array of SUB.EDIT environment parameters. The following are the definitions for the flags fields (these are also defined in the SCRIBE.FLAGS.CONSTANTS record of the INCLUDE file):
EQU ST.CHAR$ TO 1 EQU NOPAINT$ TO 2 EQU UPPER.CASE$ TO 3 EQU EDIT.NAME$ TO 4 EQU FORCE.EDIT$ TO 5 EQU REPAINT$ TO 6 EQU NOSUBVALUES$ TO 7 EQU SAVE.STATE$ TO 8 EQU NOZOOM$ TO 9 EQU NO.ORIG.VAL$ TO 10 EQU EDITOR.FLAG$ TO 11 EQU KEEP.STATUS$ TO 12
The requirements for the field values are described below:
Field Mnemonic | Description |
---|---|
<ST.CHAR$> | Pre-process commands. This must be the ASCII code for the keystroke or keystroke sequence which calls the desired process. The function key [F1], for example, would be passed as CHAR(0):CHAR(59) (see the system subroutine FUNCTION.KEY). Multiple keystroke sequences must be delimited by | or @FM. The associated operation will be performed after inval is displayed and prior to the processing of the keystroke buffer (the value of @DATA). |
<NOPAINT$> | Suppress display of text. If true, text is not initially displayed. |
<UPPER.CASE$> | Case conversion. If true, all text is converted to uppercase. |
<EDIT.NAME$> | Field name. The name of the field being edited (replaces the title in the Zoom window). |
<FORCE.EDIT$> | Insert. If true, SUB.EDIT will be activated in Insert mode. |
<REPAINT$> | Repaint. If true, the current line is displayed upon return to the SUB.EDIT edit session (saved in state <SS.LAST.VAL>). If false (the default value), the current line is not displayed. If the value is 2, the entire window is displayed (the value is then reset to false). This field value may be used in association with state specifications to redisplay text. |
<NOSUBVALUES$> | Subvalue edit. If true, subvalue editing is disabled. |
<SAVE.STATE$> | Save current state. If true, the current edit session parameters are automatically saved in state. SCRIBE will then update these parameters during the edit process. |
<NOZOOM> | $Zoom. If true, Zoom mode is disabled. |
<NO.ORIG.VALUE$> | Suppress save of inval data. If false, and if state«SS.ORIG.VAL» is null, a copy of the original inval data is saved in state (defaults to false). |
<EDITOR.FLAG$> | A boolean flag. A value of true indicates a recursive call to SUB.EDIT. |
<KEEP.STATUS$> | A boolean flag. If true, the status line is not overwritten unless a key is pressed. |
change
A flag used by SUB.EDIT to indicate whether edit changes occurred to inval data. False is returned if no changes were made, otherwise true.
lines
Use lines to specify single or multiple line entry modes. The following listed values are operable (defaults to 1):
Value | Operation |
---|---|
0 | Single line edit |
1 | Single line scroll for multiline edit. A single line is displayed, the display scrolling vertically to the next line. |
n | Full screen edit (where n is an integer indicating the number of display rows in the window). Delim must be specified. |
key
SUB.EDIT returns in key the ASCII code for the exit key used.
inpat
The value(s) of inpat determines input pattern data validation and conversion. Syntactically as well as operationally, this is exactly the same as an In Pattern operation in the Paint window (see "Data Validation" in the "Adding Advanced Features to Windows with Paint" chapter of Developing an Application in the main system documentation.). Multiple inpat statements are processed as logical OR values, and must be delimited by @VM or |. Inpat is applied to each line if lines specifies multiline or single line scroll mode.
outpat
Use outpat to specify output pattern conversion (applied line by line). Syntactically as well as operationally, this is exactly the same as an Out Pattern operation in the Paint window (see reference above under inpat).
just
Use just to specify display line justification. The possible values are:
Value | Operation |
---|---|
L | Left justified |
R | Right justified |
C | Center justified |
T | Text (text lines will wrap). Delim delimits each line. |
TN | Text nonjustified (text lines will wrap). Delim delimits each line. |
delim
The character used to delimit multiple lines of data in SUB.EDIT. This may be an accepted Advanced Revelation delimiter (e.g. @FM), an ASCII code, or a literal character. If delim is null, only single line text entry is enabled, irrespective of any other specifications (this will cause the display of inval data to be suppressed if lines specifies multiline mode).
mask
Defines an input mask. This indicates to the user the length of data expected to be input. The mask is displayed at the current edit line. If mask is a single character, it is repeated for the length of the line.
linelen
Defines the length of the edit line (defaults to 64K). If * (asterisk) is specified, the value of displen is used. A carriage return is generated at the end of the line, unless just is T or TN.
state
A dynamic array of edit session parameters. These parameters are saved in state, allowing recall of a specified edit environment.
If flags <SAVE.STATE$> is set to true, SUB.EDIT saves the current edit environment (as opposed to a specified edit environment) in state, automatically maintaining (updating) these values during the edit session. Any existing state parameters are overwritten.
Note that the state specifications save but do not redisplay the edit session data. This data may be redisplayed by setting the flags <REPAINT$> field (see above).
If state is null, any previous state settings are cleared. The following fields are defined for state (these are also defined in the SCRIBE.STATE.CONSTANTS record of the INCLUDE file):
EQU SS.ORIG.VAL TO 1 EQU SS.LAST.VAL TO 2 EQU SS.TOP TO 3 EQU SS.MVD TO 4 EQU SS.START TO 5 EQU SS.POS TO 6 EQU SS.EDITOR.ON TO 7 EQU SS.UNUSED1 TO 8 EQU SS.FIND TO 9 EQU SS.REPLACE TO 10 EQU SS.STATE TO 11 EQU SS.BLOCK.START TO 12 EQU SS.BLOCK.END TO 13
The requirements for the field values are described below:
Field | Description |
---|---|
<SS.ORIG.VAL> | Original inval data (flags<SAVE.STATE$> must be false) |
<SS.LAST.VAL> | Contents of current display line. This must be explicitly appended to the ending state field for redisplay (delimited by @RM). |
<SS.TOP> | Top display row of window |
<SS.MVD> | Display row of current line |
<SS.START> | Starting display column |
<SS.POS> | Cursor location (display column) in current line |
<SS.EDITOR.ON> | Edit flag. A setting of true enables editing; false disables it. |
<SS.UNUSED1> | Unused |
<SS.FIND> | Current search string |
<SS.REPLACE> | Current replacement string |
<SS.STATE> | Changes in edit status. Note those values passed to SUB.EDIT and those set by SUB.EDIT. The status is indicated by the following values: Value - Status null - No changes (set by SUB.EDIT) 1 - Changes in current row preceding inpat operations (set by SUB.EDIT) 2 - Process current row through inpat (passed to SUB.EDIT) 3 - Process full edit session through inpat (passed to SUB.EDIT) |
<SS.BLOCK.START> | Starting row of current block |
<SS.BLOCK.END> | Ending row of current block |
Values returned
The following is a list of the argument list parameters in which SUB.EDIT passes values, a description of the value returned, and any conditions governing the return of this value:
Parameter Value | Description | Conditions |
---|---|---|
inval | Edited inval data | None. Always returned. |
key | The key pressed to exit SCRIBE | None. Always returned. |
change | True or false (0 or 1) | None. Always returned. |
state | Current edit session parameters | SUB.EDIT must have been called with flags <SAVE.STATE$> set to true. |
Specified edit session parameters | SUB.EDIT must have been called with flags <SAVE.STATE$> set to false and the specified edit session parameters set in state. | |
The original value of inval | SUB.EDIT must have been called with flags <NO.ORIG.VAL$> set to false and state as null. |
Correct Use of SUB.EDIT
/* The following code opens the SAMPLE_CUSTOMER file, then reads record number 5. SUB.EDIT is invoked on this record, the edit display window being limited to the dimensions specified in the SUB.EDIT calling arguments. */ DECLARE SUBROUTINE SUB.EDIT, MSG, FSMSG EQU esc TO CHAR(27) EQU true TO 1 EQU false TO 0 file = "SAMPLE_CUSTOMERS" rec_key = 5 title = "Customer edit" null = "" inval = "" protect = false exit.key = esc except.key = "" col = 10 row = 5 displen = 40 ;* 40 character-wide display color = "" flags = "" change = "" lines = 8 ;* edit display window 8 lines deep exit = "" inpat = "" outpat = "" just = "" delim = "" mask = "" linelen = "" state = "" SUB.EDIT(file, rec_key, title, options, inval, protect, | exit.key, except.key, col, row, displen, color, flags, | change, lines, exit, inpat, outpat, just, delim, mask, | linelen, state)