Condividi tramite


_EdRedo( ) API Library Routine

Performs again the change made to the file in the specified editing window that was undone by the most recent _EdUndo( ).

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

Example

The following example opens for editing a file specified by a parameter. After inserting a new line, the new line is removed using _EdUndo( ), and then inserted again using _EdRedo( ).

Visual FoxPro Code

SET LIBRARY TO EDREDO  
= EDREDO("x")

C 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\n", _StrLen("Hello, world\n"));

   _Execute("WAIT WINDOW 'New line inserted.  Press any key to undo.'");
   _EdUndo(wh);

   _Execute("WAIT WINDOW 'Insertion undone.  Press any key to redo.'");
   _EdRedo(wh);
}

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

See Also

_EdUndo( ) API Library Routine | _EdUndoOn( ) API Library Routine | _EdRevert( ) API Library Routine