Class TEXTEDIT

Name

TEXTEDIT  --  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.

Synopsis

 TextEditNew(<Lrow>, <Lcol>, <Rrow>, <Rcol>, [<color>]) 	--> new TEXTEDIT object

Description

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.

Attributes

<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.
  

Methods

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 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.

Method TEXTEDIT:ADDTOCLIPBOARD()

 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.

Method TEXTEDIT:APPLYKEY()

 ApplyKey(<nKey>) 	--> nResult

ApplyKey() evaluates the code block associeated with key code <nKey> that is contained whithin SetKey() dictionary and returns <nResult>.

Method TEXTEDIT:BACKSPACE()

 BackSpace( [<lUndo>] ) 	--> NIL

BackSpace() is deleted one left letter from are current cursor position <::Line> and <::Pos>.

Method TEXTEDIT:BEGINBLOCK()

 BeginBlock(<lType>[, <lUndo>]) 	--> NIL

BeginBlock() is canceled old highlight and started new string/rectangle block.

Method TEXTEDIT:BOTTOM()

 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>.

Method TEXTEDIT:CANCELBLOCK()

 CancelBlock([<lUndo>]) 	--> NIL

CancelBlock() is unmarked text highlight.

Method TEXTEDIT:CENTERLINE()

 CenterLine([<lUndo>] ) 	--> NIL

CenterLine() is centered current line <::Line>. The <::Pos> is rested previouse.

Method TEXTEDIT:CLEAR()

 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.

Method TEXTEDIT:COPYBLOCK()

 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.

Method TEXTEDIT:COPYTOCLIPBOARD()

 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.

Method TEXTEDIT:CURWORD()

 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 <.>

Method TEXTEDIT:DELEND()

 DelEnd( [<lUndo>] ) 	--> NIL

DelEnd() is deleted all letters begin with column specified <::Pos> to the end of string <::Line>.

Method TEXTEDIT:DELETE()

 Delete( [<lUndo>] ) 	--> NIL

Delete() is called method DelRight().

Method TEXTEDIT:DELETEBLOCK()

 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.

Method TEXTEDIT:DELETELINE()

 DeleteLine( [<lUndo>] ) 	--> NIL

DeleteLine() is removed from editor buffer line specified <::Line> and decreased size of <::Edbuffer> by 1.

Method TEXTEDIT:DELHOME()

 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.

Method TEXTEDIT:DELLEFT()

 DelLeft( [<lUndo>] ) 	--> NIL

DelLeft() is called method BackSpace().

Method TEXTEDIT:DELRIGHT()

 DelRight( [<lUndo>] ) 	--> NIL

DelRight() is deleted letter in line <::Line> and column <::Pos>. The attribute <::Pos> and <::ColWin> not changes.

Method TEXTEDIT:DOWN()

 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.

Method TEXTEDIT:DRAW()

 Draw(<lDrawMode>, <nKey>[, <lUndo>] ) 	--> .T. || .F.

Draw() is drew box symbols in current position <::Line> and <::Pos>.

Method TEXTEDIT:END()

 End([<lUndo>]) 	--> NIL

End() is scrolled data to the end current line <::Line>. The <::Pos> attribute sets to len(<::Edbuffer[::Line]>)+1.

Method TEXTEDIT:ENDBLOCK()

 EndBlock(<lType>[, <lUndo>]) 	--> NIL

EndBlock() is complited text highlighting.

Method TEXTEDIT:FIND()

 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.

Method TEXTEDIT:FINDNEXT()

 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.

Method TEXTEDIT:FINDPREV()

 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.

Method TEXTEDIT:FORMATLINE()

 FormatLine([<lAutoMargin>],[ <nMarginLeft>],[ <nMarginRight>],[ <nTabSize>],[ <lHyphen>][, <lUndo>] ) 	--> NIL

FormatLine() is formatted current line <::Line> editor buffer.

Method TEXTEDIT:FORMATPART()

 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.

Method TEXTEDIT:GOTOLINE()

 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.

Method TEXTEDIT:GOTOPOS()

 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.

Method TEXTEDIT:HANDLEKEY()

 HandleKey(<nKey>[, <lUndo>]) 	--> .T. || .F.

HandleKey() is taked key code and try processed operation equal this code (Moves up, down, left, right and more).

Method TEXTEDIT:HIGHLIGHTADD()

 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.

Method TEXTEDIT:HIGHLIGHTDEL()

 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>.

Method TEXTEDIT:HOME()

 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.

Method TEXTEDIT:IDENTITY()

 Identity(<sSymb>, [<lDirect>],[ <lUndo>]) 	--> .T. || .F.

Identity() is searched identical or pair symbols: (), <>, {}, []; and set cursor to founded symbol if search is success.

Method TEXTEDIT:INSERT()

 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).

Method TEXTEDIT:INSERTLINE()

 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>

Method TEXTEDIT:INSMACRO()

 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>.

Method TEXTEDIT:INSTEMPL()

 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>.

Method TEXTEDIT:KILLNUMSTYLE()

 KillNumStyle() 	--> NIL

KillNumStyle() is sets to OFF numeric style.

Method TEXTEDIT:LEFT()

 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.

Method TEXTEDIT:LOADBLOCK()

 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.

Method TEXTEDIT:LOADFILE()

 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.

Method TEXTEDIT:LOADSTRING()

 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.

Method TEXTEDIT:MATCHSTRUCT()

 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.

Method TEXTEDIT:MOVEBLOCK()

 MoveBlock([<lUndo>]) 	--> .T. || .F.

MoveBlock() is called method CopyBlock() with first parameters TRUE.

Method TEXTEDIT:MOVETOCLIPBOARD()

 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).

Method TEXTEDIT:NEWLINE()

 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>.

Method TEXTEDIT:NEXTWORD()

 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.

Method TEXTEDIT:OVERSTRIKE()

 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).

Method TEXTEDIT:PAGEDOWN()

 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.

Method TEXTEDIT:PAGEUP()

 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.

Method TEXTEDIT:PASTEFROMCLIPBOARD()

 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.

Method TEXTEDIT:PREVWORD()

 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.

Method TEXTEDIT:PRINT()

 Print() 	--> .T.

Print() is printed editor buffer.

Method TEXTEDIT:PRINTBLOCK()

 PrintBlock() 	--> .T. || .F.

PrintBlock() is printed block if it marked.

Method TEXTEDIT:REFRESH()

 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.

Method TEXTEDIT:REPLACE()

 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.

Method TEXTEDIT:RIGHT()

 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.

Method TEXTEDIT:SAVEBLOCK()

 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.

Method TEXTEDIT:SAVEFILE()

 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.

Method TEXTEDIT:SAVESTRING()

 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.

Method TEXTEDIT:SETCHARSET()

 SetCharset(<sCharset>) 	--> NIL

SetCharset() set a new charset <sCharset> and translated data of editor buffer to host charset.

Method TEXTEDIT:SETFOCUS()

 SetFocus([<lFocus>]) 	--> lNewFocus

SetFocus() sets or kills focus. If <lFocus> not specifyed, then <::InFocus> take new value !<::InFocus>

Method TEXTEDIT:SETKEY()

 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.

Method TEXTEDIT:SETNEWCOLOR()

 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

Method TEXTEDIT:SETNUMSTYLE()

 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.

Method TEXTEDIT:TEXTEDITNEW()

 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.

Method TEXTEDIT:TOP()

 Top([<lUndo>]) 	--> NIL

Top() is scrolled data to the first string of editor buffer. The <::Line> and <::RowWin> attributes set to 1.

Method TEXTEDIT:UNDO()

 Undo() 	--> NIL

Undo() made last operation what be saved into undo buffer. The size of undo buffer specified attribute <::LenUndo>.

Method TEXTEDIT:UP()

 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.

Method TEXTEDIT:WORDLEFT()

 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.

Method TEXTEDIT:WORDRIGHT()

 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.

Method TEXTEDIT:WRITEUNDO()

 WriteUndo(<nCMD>, <vData>) 	--> NIL

WriteUndo() is saved some data into undo buffer for undo operation.

WriteUndo() invoked automaticaly from methods TEXTEDIT and not required direct activation.

Example:

  #include <inkey.ch>
 local te, nKey, str
 
 clear screen
 wopen(2, 2, 20, 40)
 te := textEditNew(0, 0, maxrow(), maxcol(), "11/1,0/2,0/3,0/7")
 te:EofString := "  ******* The happy end  ******* "
 te:lEofString := .t.
 te:LoadString("This is test string!&\n&\tThis is test string!&\n&\t&\tThis is test string!&\n")
 while .T.
 nKey := inkey(0)
 do case
 case nKey == K_ESC
 str := te:SaveString()
 exit
 case nKey == K_UP
 te:up()
 case nKey == K_DOWN
 te:down()
 case nKey == K_LEFT
 te:left()
 case nKey == K_RIGHT
 te:right()
 otherwise
 if (nKey>=32 .and. nKey<=256)
 if ( Set(_SET_INSERT) )
 te:insert(chr(nKey))
 else
 te:overStrike(chr(nKey))
 endif
 endif
 endcase
 enddo
 
 wclose()
 
 ? str
 ?
 
 

See also

Find

Platforms

No dependies of platform.