Version: 01.10.00 - last Update: Tuesday, October 138, 2009, 12:35:00
_EdGetLNum | _EdGetLPos | _EdGetPos | _EdGetStr | _EdPosInVi | _EdSkipLin
Foxtools Editor Support Functions
_EDGETCHAR
_EdGetChar() Returns a character at a given position (passed in <nPosition> parameter) in the editor session passed in <nWHAND> parameter.
VFP Syntax
cCharacter = _EdGetChar(nWHAND, nPosition)
Parameters
[in] nWHAND
Fox-window handle of the editor session in question. If nWHANDL is no valid editor-session handle, an error “API call caused an exception” (Error 2028) is raised.
[in] nPosition
Position (byte count) from beginning of the file. Position value is zero-based.
Returns
(Single) Character.
Remarks
While evaluating the nPosition parameter, _EdGetChar() counts all characters in the editor’s text buffer from the beginning starting with value 0. Thus, the very first character in the buffer hast a nPosition value of <0>. CRs at the end of each line are counted as well! It makes no difference if one has checked “Save with line feeds” in Edit Properties dialog, coz VFP drops all LFs while loading the file content into its editor buffer. Visually, the character right from the caret is returned, if one uses the caret’s position value returned by _EDGetPos().
Note: If nPosition points to the end of the editor’s text buffer (@ EOF) or beyond EOF, then always CHR(32) is returned!!
VFP Example(s)
Opening an editor session, returning character right from the caret:
*\\ Open editor session nWHAND =_EDOPENFIL("TEST.TXT", 0)
*\\ Caret is on nPosition=0 after opening
*\\ Return 1st character after caret
? _EDGETCHAR(m.nWHAND, _EDGETPOS(m.nWHAND))
*\\ Close editor session
= _EDCLOSEFI(m.nWHAND, 0)
*//