Foxtools – Editor _EDUNDO

Version: 01.10.10 - last Update: Tuesday, October 13, 2009, 13:00:00

Previous ChapterFoxtools Home (Alphabetical TOC)Foxtools Home (Grouped TOC)Next Chapter See also:_EdRedo | _EdUndoOn


Foxtools Editor Support Functions

_EDUNDO

_EdUndo() undoes the most recent changes/edits in the editor session window passed in <nWHAND> parameter.

VFP Syntax

= _EdUndo(nWHAND)

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.

Returns

VOID - no evaluable return value, coz always TRUE.

Remarks

_EdUndo() may be called more than once in a row to roll back more than one action. Edit actions that can be undone or reverted (using _EdUndo() and _EdRedo()) may be grouped enclosing them between _EdUndoOn() commands.

VFP Example(s)

Opening an editor session, activating undo-grouping, adding some text, finally doing one _EdUndo() to roll back the whole sequence:

*\\ Open editor session
nWHAND =_EDOPENFIL("TEST.TXT", 1)
*\\ set undo-grouping ON
=_EDUNDOON(m.nWHAND,.T.)
*//
lcText = "NEW TEST"
*\\ insert 1st word
= _EDINSERT(m.nWHAND,m.lcText,3)
*\\ new line
= _EDSENDKEY(m.nWHAND,13)
*\\ insert 2 words
= _EDINSERT(m.nWHAND, m.lcText, LEN(m.lcText))
*\\ new line
= _EDSENDKEY(m.nWHAND,13)
*\\ more words
lcText = "Much more TEXT"
= _EDINSERT(m.nWHAND,m.lcText, LEN(m.lcText))
= _EDINSERT(m.nWHAND,"!",1)
*\\ new line
= _EDSENDKEY(m.nWHAND,13)
*\\ Caret on row#1
= _EDSETPOS(m.nWHAND,0)
*\\ Indent row#1 with 1 tab stop
= _EDINDENT(m.nWHAND,1) 
*\\ set undo-grouping OFF
=_EDUNDOON(m.nWHAND,.F.)
*//
WAIT WINDOW "Press any key to UNDO all changes"
= _EDUNDO(m.nWHAND)

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