Version: 01.01.00 - last Update: Tuesday, October 13, 2009, 11:35:00
_EdActive | _EdSetPos | _EdSToPos
Foxtools Editor Support Functions
_EDSTOSEL
_EdSToSel() Scrolls editor session window passed in <nWHAND> parameter so that the highlighted area becomes visible. The function name is an abbreviation for “Editor Scroll To Selection” and has nothing to do with “storing” something (like one can read in other documentations out in the dark :-)
VFP Syntax
= _EdSToSel(nWHAND, 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] lCenter
If TRUE, then the highlighted text is vertically centred in the editor session window. If FALSE, then the highlighted text is made visible without vertical centring. Note: If you use FALSE and have highlighted more than a single line of text, then _EdSToSel() does NOT make the whole text block visible, but only scrolls as long as no selected line is visible! As soon as the first highlighted line becomes visible, scrolling stops like shown below:
Returns
VOID - no evaluable return value, coz always TRUE.
Remarks
The _EdSToSel() does not move the caret. If the highlighted text is already visible (must be fully displayed), then calling _EdSToSel() with <lCenter> = .F. does nothing. Calling _EdSToSel() with <lCenter> = .T. may move the highlighted text to vertical centre if it isn’t already centred. If the editor session window doesn’t have a vertical scroll bar displayed, the _EdSToSel() does nothing, coz there is nothing to scroll :-)
VFP Example(s)
Opening an editor session, selecting some text, finally scrolling text so that the highlighted block will be displayed centred:
*\\ Open editor session nWHAND =_EDOPENFIL("TEST.TXT", 1) nLineNo = 09 && from line 10 nFromLine = _EdGetLPos(nWHAND, m.nLineNo) nLineNo = 15 && to line 15 nToLine = _EdGetLPos(nWHAND, m.nLineNo)-1 *\\ select the text block _EDSELECT(m.nWHAND, m.nFromLine, m.nToLine) = _EdSToSel(m.nWHAND, .F.)