Condividi tramite


_EdSkipLines( ) API Library Routine

Moves the insertion point to the beginning of the line int lines from its current offset position thePos.

EDPOS _EdSkipLines(WHANDLE wh, EDPOS thePos, int offset)
WHANDLE wh;            /* Handle of editing window. */
EDPOS thePos;               /* Current offset position. */
int offset;                     /* Number of lines to skip. */

Remarks

You can specify a positive or negative number of lines.

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

Example

The following example opens for editing a file specified by a parameter. It uses _EdSkipLines( ) to find the offset positions, then selects lines 3 and 4.

Visual FoxPro Code

SET LIBRARY TO EDSKIPLI
= SKIPLINE("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;
   EDPOS edpos;

   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);

   // select next two lines
   edpos = _EdSkipLines(wh, 0, 2); // skip to two lines from top
   _EdSelect(wh, edpos, _EdSkipLines(wh, edpos, 2));
   _Execute("WAIT WINDOW 'Using _EdSkipLines() \
      to select lines 3 and 4'");
}

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

See Also

_EdGetPos( ) API Library Routine |_EdSetPos( ) API Library Routine | Accessing the Visual FoxPro API