JavaScript Editor js editor     Web development 

Main Page

Enables you to group a series of actions as a single action for use with _EdUndo(В ) and _EdRedo(В ).

void _EdUndoOn(WHANDLE wh, int Grouped)
WHANDLE wh;            /* Window handle. */
int Grouped;                  /* Toggle grouping off. */


Actions that occur after you pass the Grouped parameter as FALSE with _EdUndoOn(В ), or after you issue _EdUndo(В ), are no longer grouped as a single action.

For more information on how to create an API library and integrate it with Visual FoxPro, see Accessing the Visual FoxPro API.


The following example shows how to use _EdUndoOn(В ) to group edit operations that you can undo as a group using _EdUndo(В ).

Visual FoxPro Code

В Copy Code
= EDUNDOON("x")  && edit file "x"

C Code

В Copy Code
#include <pro_ext.h>
#define TRUE   1
#define FALSE   0

FAR Example(ParamBlk FAR *parm)
   char FAR *pFileName;
   WHANDLE wh;

   if (!_SetHandSize(parm->p[0].val.ev_handle, 
      _Error(182); // "Insufficient memory"
   pFileName = (char FAR *) _HandToPtr(parm->p[0].val.ev_handle);
   pFileName[parm->p[0].val.ev_length] = '\0';
   wh = _EdOpenFile(pFileName, FO_READWRITE);

   _EdUndoOn(wh, TRUE); // start undo group

   _EdSetPos(wh, _EdGetLinePos(wh, 13));
   _EdInsert(wh, "Hello, world\n", _StrLen("Hello, world\n"));
   _EdSelect(wh, _EdGetLinePos(wh, 14), _EdGetLinePos(wh, 16));
   _EdIndent(wh, 1);

   _EdUndoOn(wh, FALSE); // end undo group
   _EdUndoOn(wh, TRUE); // start another undo group

   _EdSelect(wh, _EdGetLinePos(wh, 9), _EdGetLinePos(wh, 12));
   _EdSetPos(wh, _EdGetLinePos(wh, 13));
   _EdInsert(wh, "Hello, world\n", _StrLen("Hello, world\n"));

   _Execute("WAIT WINDOW 'Press any key to undo changes.'");
   _EdUndoOn(wh, TRUE); // undoes to start of undo group

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

See Also

JavaScript Editor js editor     Web development