Foxtools – Editor _EDSTOPOS

Version: 01.00.10 - last Update: Tuesday, October 13, 2009, 11:40:00

Previous ChapterFoxtools Home (Alphabetical TOC)Foxtools Home (Grouped TOC)Next Chapter See also:_EdActive | _EdSetPos | _EdSToSel


Foxtools Editor Support Functions

_EDSTOPOS

_EdSToPos() Scrolls editor session window passed in <nWHAND> parameter so that a given position is visible. The function name is an abbreviation for “Editor Scroll To Position” and has nothing to do with “storing” something (like one can read in other documentations out in the dark :-)

VFP Syntax

= _EdSToPos(nWHAND, nOffset, lCenter)

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] nOffset

Offset position from beginning of file that should be made visible. The <nOffset> value is zero-based. CRs @ EOL are counted, too.

[in] lCenter

If TRUE, then the offset position <nOffset> is vertically centred in the editor session window. If FALSE, then the offset position <nOffset> only is made visible (without vertical centring) within the editor session window.

Returns

VOID - no evaluable return value, coz always TRUE.

Remarks

The _EdSToPos() does not move the caret. If the target line (the one containing the <nOffset> offset position) is already visible (must be fully displayed), then calling  _EdSToPos() with <lCenter> = .F. does nothing. Calling  _EdSToPos() with <lCenter> = .T. may move the target line to vertical centre if it isn’t already centred. If the editor session window doesn’t have a vertical scroll bar displayed, the _EdSToPos() does nothing, coz there is nothing to scroll :-)

VFP Example(s)

Opening an editor session, scrolling down so that line#30 will be displayed centred:

*\\ Open editor session
nWHAND =_EDOPENFIL("TEST.TXT", 1)
nLineNo = 29 && line 30
nBOLposLineX = _EdGetLPos(nWHAND, m.nLineNo)
= _EdSToPos(m.nWHAND, nBOLposLineX, .T.)
*\\ Typically _EdSToPos() is used in conjunction with _EDPOSINVI()
IF NOT _EDPOSINVI(m.nWHAND, m.nBOLposLineX) 
   =_EDSTOPOS(m.nWHAND, m.nBOLposLineX, .F.)
ENDIF

Previous ChapterFoxtools Home (Alphabetical TOC)Foxtools Home (Grouped TOC)Next Chapter