JavaScript Editor js editor     Web development 



Main Page

Discards all changes made to the file displaying in the specified editing window since it was most recently saved with _EdSave(В ).

void _EdRevert(WHANDLE wh)
WHANDLE wh;            /* Handle of editing window. */

Example

The following example opens for editing a file specified by a parameter. After some editing, insertion of a new line, indenting of two lines, and deletion of two lines, the changes are discarded using _EdRevert(В ).

Visual FoxPro Code

В Copy Code
SET LIBRARY TO EDREVERT
= EDREVERT("x")

C Code

В Copy Code
#include <pro_ext.h>

FAR Example(ParamBlk FAR *parm)
{
#define pFILENAME ((char FAR *) _HandToPtr(parm->p[0].val.ev_handle))

   WHANDLE wh;

   if (!_SetHandSize(parm->p[0].val.ev_handle,
      parm->p[0].val.ev_length+1))
   {
      _Error(182); // "Insufficient memory"
   }
   pFILENAME[parm->p[0].val.ev_length] = '\0';

   _HLock(parm->p[0].val.ev_handle);
   wh = _EdOpenFile(pFILENAME, FO_READWRITE);
   _HUnLock(parm->p[0].val.ev_handle);

   _EdSetPos(wh, _EdGetLinePos(wh, 13));
   _EdInsert(wh, "Hello, world\r\n", _StrLen("Hello, world\n"));

   _EdSelect(wh, _EdGetLinePos(wh, 14), _EdGetLinePos(wh, 16));
   _EdIndent(wh, 1);

   _EdSelect(wh, _EdGetLinePos(wh, 9), _EdGetLinePos(wh, 12));
   _EdDelete(wh);

   _EdRevert(wh);
}

FoxInfo myFoxInfo[] = {
   {"EDREVERT", (FPFI) Example, 1, "C"},
};
FoxTable _FoxTable = {
   (FoxTable FAR *) 0, sizeof(myFoxInfo)/sizeof(FoxInfo), myFoxInfo
};

See Also



JavaScript Editor js editor     Web development