Class are destined to manipulating text data - load/save from file/string, insert, delete, manipulation with marked data and clipboard, formated text and more. TEXTEDIT is a base class for function memoedit and class MEDIT.
<ClassName> | TEXTEDIT |
<Path> | String, path to editing file |
<FileName> | String, file name of editing file |
<ColorSpec> | String, color specification. If parameters <color> not specified, |
this attributes take value from SetColor() | |
"clr1, clr2, clr3, clr4" | |
clr1 - symbols base color | |
clr2 - EOF-string color | |
clr3 - mark symbols color | |
clr4 - mark founded symbols color | |
<nTop> | a TEXTEDIT viewport coordinates, specified by <Lrow> parameters |
<nLeft> | a TEXTEDIT viewport coordinates, specified by <Lcol> parameters |
<nBottom> | a TEXTEDIT viewport coordinates, specified by <Rrow> parameters |
<nRight> | a TEXTEDIT viewport coordinates, specified by <Rcol> parameters |
<Lines> | Numeric, lines in TEXTEDIT |
<Line> | Numeric, current line |
<Pos> | Numeric, cursor position into current line |
<ColWin> | Numeric, cursor position into TEXTEDIT viewport |
<RowWin> | Numeric, cursor position into TEXTEDIT viewport |
<Updated> | Logical, is TRUE if data changed |
<MarginLeft> | Numeric, the left margin value, specified as TE_MARGIN_LEFT |
<MarginRight> | Numeric, the right margin value, specified as TE_MARGIN_RIGHT |
<TabSize> | Numeric, the tabulation size value, specified as TE_TABSIZE |
<Hyphen> | Logical, if TRUE, then hyphen, specified as TE_HYPHEN |
<MaxStrings> | Numeric, the max strings value in TEXTEDIT, specified as TE_MAXSTRINGS |
<TabPack> | Logical, if TRUE, all symbols Tab will be packing by load and save string/file. |
By default specified as set("edit_tabpack") | |
<InFocus> | Logical, if TRUE object in focus. |
<MkBlock> | Logical, if TRUE then block is marked. |
<StrBlock> | Logical, if TRUE then string block is marked. |
<RectBlock> | Logical, if TRUE then rectangle block is marked. |
<KoordBlock> | Array of numeric value, the block coordinates {<nTop>, <nLeft>, <nBottom>, <nRight>} or |
{<nBottom>, <nRight>, <nTop>, <nLeft>} | |
<LenUndo> | Numeric, the length undo buffer. By default is 100. |
<Charset> | String, data charset. |
<EofString> | String, the text of <end of file>. By default is <EOF> |
<lEofString> | Logical, if TRUE, showing string <EofString> as last string |
of viewing data. | |
<HighLightColor> | MAP, the map includes string numer what selected special color. |
<Nstyle> | Logical, is TRUE if every line into TEXTEDIT viewport has string |
number. | |
<EdBuffer> | Array, array of string to edit. It is editor buffer. |
ADDTOCLIPBOARD | Add block to clipboard. |
APPLYKEY | Evalute the code block. |
BACKSPACE | Delete left letter. |
BEGINBLOCK | Start block hightlighting. |
BOTTOM | Goes to the last string of editor buffer. |
CANCELBLOCK | Unmarking block. |
CENTERLINE | Centering line. |
CLEAR | Clear editor buffer. |
COPYBLOCK | Make copy block. |
COPYTOCLIPBOARD | Copy block to clipboard. |
CURWORD | Take word specified by position line and column. |
DELEND | Delete letters to the end of string. |
DELETE | Delete letter. |
DELETEBLOCK | Make remove block. |
DELETELINE | Delete line. |
DELHOME | Delete letters to begin of string. |
DELLEFT | Delete left letter. |
DELRIGHT | Delete letter. |
DOWN | Goes down one line. |
DRAW | Draw one of box characters. |
END | Goes to the last line postion. |
ENDBLOCK | Stop block hightlighting. |
FIND | Finds string into editor buffer. |
FINDNEXT | Continue search forward. |
FINDPREV | Continue search backward. |
FORMATLINE | Formatting line. |
FORMATPART | Formatting part. |
GOTOLINE | Goes to specified line. |
GOTOPOS | Goes to specified column. |
HANDLEKEY | Simple handle key. |
HIGHLIGHTADD | Mark highlight line some colors. |
HIGHLIGHTDEL | Unmark highlight line some color. |
HOME | Goes to the first line postion. |
IDENTITY | Search identity alpha character. |
INSERT | Insert alpha character or substring to the editor buffer. |
INSERTLINE | Insert new line. |
INSMACRO | Make macro and insert result to editor buffer. |
INSTEMPL | Insert substring by template. |
KILLNUMSTYLE | Off the style "NUMERIC" |
LEFT | Goes left one column. |
LOADBLOCK | Make load block from file. |
LOADFILE | Load file. |
LOADSTRING | Load string to editor buffer. |
MATCHSTRUCT | Matching structure. |
MOVEBLOCK | Make move block. |
MOVETOCLIPBOARD | Move block to clipboard. |
NEWLINE | Goes new line. |
NEXTWORD | Take next word of word specified by position line and column. |
OVERSTRIKE | Replace alpha character or substring into editor buffer. |
PAGEDOWN | Goes down one page. |
PAGEUP | Goes up one page. |
PASTEFROMCLIPBOARD | Paste block from clipboard. |
PREVWORD | Take previous word of word specified by position line and column. |
Print. | |
PRINTBLOCK | Print marked block. |
REFRESH | Refresh TEXTEDIT viewport. |
REPLACE | Find with replace string into editor buffer. |
RIGHT | Goes right one column. |
SAVEBLOCK | Make save block to file. |
SAVEFILE | Save to file. |
SAVESTRING | Save editor buffer to string. |
SETCHARSET | Set charset to translate editor data. |
SETFOCUS | Set/kill focus. |
SETKEY | Set a code block associated with code key value. |
SETNEWCOLOR | Set new colors TEXTEDIT. |
SETNUMSTYLE | On/Off the draw style "NUMERIC" |
TEXTEDITNEW | TEXTEDIT object constructor. |
TOP | Goes to the first string of editor buffer. |
UNDO | Make undo operation. |
UP | Goes up one line. |
WORDLEFT | Goes left one word. |
WORDRIGHT | Goes right one word. |
WRITEUNDO | Save undo information. |
AddToClipboard(<aClipbrd>) --> NIL
AddToClipboard() is added marked block from editor buffer to the end of array <aClipbrd>. <aClipbrd> - it is not system clipboard. The size of <::Edbuffer> not changed. Mark block not unmarked.
ApplyKey(<nKey>) --> nResult
ApplyKey() evaluates the code block associeated with key code <nKey> that is contained whithin SetKey() dictionary and returns <nResult>.
BackSpace( [<lUndo>] ) --> NIL
BackSpace() is deleted one left letter from are current cursor position <::Line> and <::Pos>.
BeginBlock(<lType>[, <lUndo>]) --> NIL
BeginBlock() is canceled old highlight and started new string/rectangle block.
Bottom([<lUndo>]) --> NIL
Bottom() is scrolled data to the last string of editor buffer (last element of <::EdBuffer>). The <::Line> attribute set to <::Lines> and <::RowWin> set to <::nBottom>-<::nTop>.
CancelBlock([<lUndo>]) --> NIL
CancelBlock() is unmarked text highlight.
CenterLine([<lUndo>] ) --> NIL
CenterLine() is centered current line <::Line>. The <::Pos> is rested previouse.
Clear() --> NIL
Clear() is cleared editor buffer and init all counters to zero. Size array <::EdBuffer> trucate to 1 and it element sets to empty string.
Attention! This method not writing undo information.
CopyBlock([<lMove>[, <lUndo>]]) --> .T. || .F.
CopyBlock() moved cursor to begin marked block (line and column) and copied or moved (if <lMove> is TRUE) marked block to new positon specified current cursor position line <::Line> and column <::Pos> in editor buffer.
If block not marked method returns FALSE.
When do operation copy, block copied into new position and size editor buffer <::EdBuffer> increased by size block(lines in block).
Move is equaled to copy, but in the previous place the block is removed.
CopyToClipboard(<aClipbrd>) --> NIL
CopyToClipboard() is copied marked block from editor buffer to array <aClipbrd>. <aClipbrd> - it is not system clipboard. The size of <::Edbuffer> not changed. Mark block not unmarked.
CurWord([<nPos>], [nLine>],[ <lUndo>]) --> sCurrentWord
CurWord() is searched word by position <nLine> and <nPos> and return it if found. Oher return empty string.
Word it is sequential of symbols without space and comma <,> and point <.>
<nPos> | - Numeric, starting column to search in line <nLine>. If not specified sets to <::Pos> |
<nLine> | - Numeric, starting line to search. If not specified sets to <::Line> |
<lUndo> | - Logical, is TRUE (by default) if operation saved in undo buffer. |
Returns : | Returns curren word in specified position column and line. |
DelEnd( [<lUndo>] ) --> NIL
DelEnd() is deleted all letters begin with column specified <::Pos> to the end of string <::Line>.
DeleteBlock([<lUndo>]) --> .T. || .F.
DeleteBlock() moved cursor to begin marked block (line and column) and removed marked block from editor buffer. The size of <::Edbuffer> decreased by size removes block(lines in block).
If block not marked, DeleteBlock() returns FALSE.
DeleteLine( [<lUndo>] ) --> NIL
DeleteLine() is removed from editor buffer line specified <::Line> and decreased size of <::Edbuffer> by 1.
DelHome( [<lUndo>] ) --> NIL
DelHome() is deleted all letters in line <::Line> with string begin to column <::Pos>. The attribute <::Pos> and <::ColWin> sets to 1.
DelRight( [<lUndo>] ) --> NIL
DelRight() is deleted letter in line <::Line> and column <::Pos>. The attribute <::Pos> and <::ColWin> not changes.
Down([<lUndo>]) --> NIL
Down() is skipped editor buffer on the new position <::Line>+1. The <::Line> and <::RowWin> attributes increased by 1. If <::RowWin> is more then bottom boundary of viewport, <::RowWin> take value <::nBottom>-<::nTop>+1 and text in viewport scrolled up on 1 line.
Draw(<lDrawMode>, <nKey>[, <lUndo>] ) --> .T. || .F.
Draw() is drew box symbols in current position <::Line> and <::Pos>.
End([<lUndo>]) --> NIL
End() is scrolled data to the end current line <::Line>. The <::Pos> attribute sets to len(<::Edbuffer[::Line]>)+1.
EndBlock(<lType>[, <lUndo>]) --> NIL
EndBlock() is complited text highlighting.
Find(<oFind>[, <lUndo>]) --> .T. || .F.
Find() is make the search string or regular expression in editor buffer. The <oFind> contain searching parameters(expression, direct, case-sensitive and the like). If expression found cursor moved to the founded word. This word will be marked special color (<clr4> from <::ColorSpec>).
If find is success, method returns TRUE. In other returns FALSE.
FindNext(<oFind>[, <lUndo>]) --> .T. || .F.
FindNext() is continued search started in <::Find()> to forward. The <oFind> contain searching parameters(expression, case-sensitive and the like). The attribute <::Direct> of <oFind> sets to 1. If expression found cursor moved to the founded word.
FindPrev(<oFind>[, <lUndo>]) --> .T. || .F.
FindNext() is continued search started in <::Find()> to forward. The <oFind> contain searching parameters(expression, case-sensitive and the like). The attribute <::Direct> of <oFind> sets to 2. If expression found cursor moved to the founded word.
FormatLine([<lAutoMargin>],[ <nMarginLeft>],[ <nMarginRight>],[ <nTabSize>],[ <lHyphen>][, <lUndo>] ) --> NIL
FormatLine() is formatted current line <::Line> editor buffer.
<lAutoMargin> | - Logical, is TRUE(by default) if need make automaticaly left margin. |
<nMarginLeft> | - Numeric, the left margin value (by default <::MarginLeft>) |
<nMarginRight> | - Numeric, the right margin value (by default <::MarginRight>) |
<nTabSize> | - Numeric, the tabulation value (by default <::TabSize>) |
<lHyphen> | - Logical, is TRUE if hyphen (by default <::Hyphen>). |
<lUndo> | - Logical, is TRUE(by default) if operation saved in undo buffer. |
Returns : | Returns NIL. |
FormatPart([<lAutoMargin>],[ <nMarginLeft>],[ <nMarginRight>],[ <nTabSize>],[ <lHyphen>][, <lUndo>] ) --> NIL
FormatPart() is part formatted begin from <::Line> to the line whose position first character in line not equal posiiotn first character formatted part or to the end of editor buffer.
<lAutoMargin> | - Logical, is TRUE(by default) if need make automaticaly left margin. |
<nMarginLeft> | - Numeric, the left margin value (by default <::MarginLeft>) |
<nMarginRight> | - Numeric, the right margin value (by default <::MarginRight>) |
<nTabSize> | - Numeric, the tabulation value (by default <::TabSize>) |
<lHyphen> | - Logical, is TRUE if hyphen (by default <::Hyphen>). |
<lUndo> | - Logical, is TRUE(by default) if operation saved in undo buffer. |
Returns : | Returns NIL. |
GotoLine(<nLine>[, <lUndo>]) --> .T. || .F.
GotoLine() is moved cursor to the new row position <nLine> if <nLine> between 1 and <::Lines>. editor buffer scrolled to the new line. Attribute <::Line> sets to <nLine>.
In other cursor not moved and method returns FALSE.
GotoPos(<nPos>[, <lUndo>]) --> .T. || .F.
GotoPos() is moved cursor to the new column position <nPos>. editor buffer scrolled to the new position. Attribute <::Pos> sets to <nPos>.
In other cursor not moved and method returns FALSE.
HandleKey(<nKey>[, <lUndo>]) --> .T. || .F.
HandleKey() is taked key code and try processed operation equal this code (Moves up, down, left, right and more).
HighLightAdd(<nLine>, <nColorItem>) --> .T. || .F.
HighLightAdd() is highlighted line <nLine> and added information about color highlighting to map <::HighLightColor>.
One line can take a few colors to highlighting.
HighLightDel(<nLine>, <nColorItem>) --> .T. || .F.
HighLightDel() is undo highlight line <nLine> with color specified <nColorItem>. and removed information about this color highlighting from map <::HighLightColor>.
Home([<lUndo>]) --> NIL
Home() is scrolled data to the first character not equal <space> of current line <::Line>.
The second call this method moves cursor to begin line.
Identity(<sSymb>, [<lDirect>],[ <lUndo>]) --> .T. || .F.
Identity() is searched identical or pair symbols: (), <>, {}, []; and set cursor to founded symbol if search is success.
Insert( <sStr>, [<lUndo>] ) --> NIL
Insert() is inserted substring <sStr> to the editor buffer begin of <::Pos> and in line <::Line>.
If <::Line> is more then size of editor buffer <::Lines>, then size of <::EdBuffer> increased to <::Line>.
The new cursor position into editor buffer is <::Line> and <::Pos>+len(sStr).
InsertLine([<lUndo>][, [lAuto]] ) --> NIL
InsertLine() is inserted new line into editor buffer after line <::Line>-1. The size editor buffer increased by 1 and lines begin with <::Line>+1 moved down by one.
The current line kept previouse - <::Line>.
If <lAuto>, then <::Pos> sets to first column with not empty alpha character of previouse line <::Line>-1.
In other, <::Pos> sets to value <::MarginLeft>
InsMacro(<aTempl>[, <lUndo>] ) --> NIL
InsMacro() made macro specified some template and replace this template to result expression. In this case template is word in line <::Line> and column <::Pos>.
InsTempl(<aTempl>[, <lUndo>] ) --> NIL
InsTempl() is replaced current word (template word) to value from a <aTempl> whose key equal template.
<sStr> can include symbol </> it is line delimiter. In this case will be inserted some string begin with column <::Pos>.
Left([<lUndo>]) --> NIL
Left() goes left one column. The <::Pos> and <::ColWin> attributes decreased by 1. If <::ColWin> is less then 1, <::ColWin> take value 1 and text in viewport scrolled one column to right.
LoadBlock(<sFileName>[, <lUndo>]) --> .T. || .F.
LoadBlock() is loaded data from file <sFileName> to block and inserted block to editor buffer from a current line <::Line> and marked block.
The size editor buffer <::EdBuffer> increased by size of block.
LoadFile(<sFileName>) --> .T.
LoadFile() is loaded file to editor buffer. Method splitted input string on substring with delimiter - hard carriage. Substrings translated from <::CharSet> to host charset and stored in <::Edbuffer>. Previous data of <::EdBuffer> removes.
If file not exist or not opened (access denied) method returns FALSE. <::EdBuffer> not changed.
Attention! This method not writing undo information.
LoadString(<sStr>) --> .T.
LoadString() is loaded string to editor buffer. Method splitted input string on substring with delimiter - hard carriage. Substrings translated from <::CharSet> to host charset and stored in <::Edbuffer>. Previous data of <::EdBuffer> removes.
Attention! This method not writing undo information.
MatchStruct(<sWord>, [<lDirect>],[ <lUndo>]) --> .T. || .F.
MatchStruct() is searched item of Clipper-like structures:
DO CASE; CASE; OTHERWISE; END[CASE]
DO[ WHILE]; LOOP; END[DO]
IF; ELSE; [ELSEIF]; END[IF]
...
and set cursor to founded item if search is success.
All items can be lower/upper case. Every structure can be embedded to others.
MoveBlock([<lUndo>]) --> .T. || .F.
MoveBlock() is called method CopyBlock() with first parameters TRUE.
MoveToClipboard(<aClipbrd>) --> NIL
MoveToClipboard() is moved marked block from editor buffer to array <aClipbrd>. <aClipbrd> - it is not system clipboard.
Cursor moved to begin marked block and block removed from editor buffer. The size of <::Edbuffer> is decreased by size block (block lines).
NewLine([<lUndo>][, <lAuto>] ) --> NIL
NewLine() is moved cursor to new line <::Line>+1. The size editor buffer not changed.
The current line <::Line> increased by 1.
If <lAuto> is TRUE, then <::Pos> sets to column value of start not empty symbol. In other, <::Pos> sets to value <::MarginLeft>.
NextWord([<nPos>], [nLine>],[ <lUndo>]) --> sPrevWord
NextWord() is searched word following for word specified <nLine> and <nPos> and return it if found. Oher return empty string.
<nPos> | - Numeric, starting column to search in line <nLine>. If not specified sets to <::Pos> |
<nLine> | - Numeric, starting line to search. If not specified sets to <::Line> |
<lUndo> | - Logical, is TRUE (by default) if operation saved in undo buffer. |
Returns : | Returns next word of word specified with column and line. |
OverStrike( <sStr>, [<lUndo>] ) --> NIL
OverStrike() is replaced substring with length len(sStr) to <sStr> into line <::Line> and begining with <::Pos> .
The new cursor position into editor buffer is <::Line> and <::Pos>+len(sStr).
PageDown([<lUndo>]) --> NIL
PageDown() is skipped editor buffer on the new position <::Line>+<::nBottom>-<nTop>. The <::Line> attribute increased by <::nBottom>-<nTop>. Data in viewport scrolled up on <::nBottom>-<nTop> line.
PageUp([<lUndo>]) --> NIL
PageUp() is skipped editor buffer on the new position <::Line>-<::nBottom>-<nTop>. The <::Line> attribute decreased by <::nBottom>-<nTop>. Data in viewport scrolled down on <::nBottom>-<nTop> line.
PasteFromClipboard(<aClipbrd>[, <nItem>][, <lUndo>]) --> .T. || .F.
PasteFromClipboard() is pasted block from clipboard to current <::Line> and <::Pos> into editor buffer.
Block not removed from editor buffer. The size of <::Edbuffer> is increased by size block (block lines).
If array <aClipbrd> is empty, then PasteFromClipboard() returns FALSE; in other returns TRUE.
PrevWord([<nPos>], [nLine>],[ <lUndo>]) --> sPrevWord
PrevWord() is searched word preceding of word specified <nLine> and <nPos> and return it if found. Oher return empty string.
<nPos> | - Numeric, starting column to search in line <nLine>. If not specified sets to <::Pos> |
<nLine> | - Numeric, starting line to search. If not specified sets to <::Line> |
<lUndo> | - Logical, is TRUE (by default) if operation saved in undo buffer. |
Returns : | Returns previous word of word specified with column and line. |
PrintBlock() --> .T. || .F.
PrintBlock() is printed block if it marked.
Refresh() --> NIL
Refresh() is refreshed TEXTEDIT viewport and positioned cursor on the screen to new position if it need.
Refresh() invoked automaticaly from all methods of TEXTEDIT.
Replace(<oFind>[, <lUndo>]) --> .T. || .F.
Replace() is make the search string or regular expression in editor buffer. The <oFind> contain searching parameters(searchin expression, replaced string, direct, case-sensitive and the like). If expression found, it will be replace on string to replace <oFind:Rstring>. This substring will be marked special color (<clr4> from <::ColorSpec>).
If operation is success, method returns TRUE. In other returns FALSE.
Right([<lUndo>]) --> NIL
Right() goes right one column. The <::Pos> and <::ColWin> attributes increased by 1. If <::ColWin> is more then right boundary viewport, <::ColWin> take value <::nRight>-<nLeft> + 1 and text in viewport scrolled one column to left.
SaveBlock(<sFileName>[, <lCreateBak>[, <lUndo>]]) --> .T. || .F.
SaveBlock() is saved marked string/rectangle block to file <sFileName>. If file <sFileName> not exist, method created it. In other, rewrited.
If block not marked or error emerge by creating file, method returns FALSE.
SaveFile(<sFileName>[, <lCreateBak>]) --> .T.
SaveFile() is saved editor buffer to file.
If file <sFileName> not exist, method created it. In other file rewrited from editor buffer. <::Updated> set to FALSE.
If access denied, editor buffer not saved and method returns FALSE.
Attention! This method not writing undo information.
SaveString() --> sStr
SaveString() is packed editor buffer to string and returns it. Substrins tranlated to <::Charset> and write to result string with delimiters CR.
Attention! This method not writing undo information.
SetCharset(<sCharset>) --> NIL
SetCharset() set a new charset <sCharset> and translated data of editor buffer to host charset.
SetFocus([<lFocus>]) --> lNewFocus
SetFocus() sets or kills focus. If <lFocus> not specifyed, then <::InFocus> take new value !<::InFocus>
SetKey(<nKey>[, <bData>]) --> bPreviouse
SetKey() is sets a new code block associated with code <nKey>. When replacing an existing code block definition, it returns previous code block, in other returns current one. Its associated key code will be evaluated ApplyKey() methods.
If <bData> is NIL, SetKey() returns old block code and remove keypress/code block definition.
A default key code is cursor moves(K_UP, K_DOWN, K_LEFT, K_RIGHT, K_PGUP, K_PGDN, K_HOME, K_END ....) associates with corresponded methods Left(), Right(), Up(), Down() and more.
SetNewColor(<sNewColor>) --> NIL
SetNewColor() is sets new color specification to TEXTEDIT. The method Refresh() used 4 colors item to draw editor buffer:
<sNewColor> := "<clr1>, <clr2>, <clr3>, <clr4>[, ...<clrN>]" <clr1> - symbols base color <clr2> - EOF-string color <clr3> - mark symbols color <clr4> - mark founded symbols color ... <clrN> - users color
SetNumStyle([<lNum>]) --> NIL
SetNumStyle() is sets to ON/OFF numeric style. If ON, then every line of editor buffer draw into viewport with same number.
TextEditNew(<Lrow>, <Lcol>, <Rrow>, <Rcol>, [<color>]) --> new TEXTEDIT object
TextEditNew() is constructs and returns new TEXTEDIT object. That class can be used to edit, view, control some data - string or file.
Top([<lUndo>]) --> NIL
Top() is scrolled data to the first string of editor buffer. The <::Line> and <::RowWin> attributes set to 1.
Undo() --> NIL
Undo() made last operation what be saved into undo buffer. The size of undo buffer specified attribute <::LenUndo>.
Up([<lUndo>]) --> NIL
Up() is skipped editor buffer on the new position <::Line>-1. The <::Line> and <::RowWin> attributes decreased by 1. If <::RowWin> is less then 1, <::RowWin> take value 1 and text in viewport scrolled down on 1 line.
WordLeft([<lUndo>]) --> NIL
WordLeft() moves cursor to begin left word from current word. The <::Pos> and <::ColWin> attributes takes new value corresponded first character new word.
WordRight([<lUndo>]) --> NIL
WordRight() moves cursor to begin right word from current word. The <::Pos> and <::ColWin> attributes takes new value corresponded first character new word.