Compartir a través de


_EdIndent( ) API Library Routine

Indents the selected text in the file in the specified window the specified number of tab stops.

void _EdIndent(WHANDLE wh, int tabstops)
WHANDLE wh;            /* Handle of editing window. */
int tabstops;                  /* Number of tab stops. */

Remarks

You can specify a negative number for tabstops to cause a hanging indent for the selection.

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 an editing session for a file specified by a parameter, and indents lines 13 and 15 in the file by a single tab stop.

Visual FoxPro Code

SET LIBRARY TO EDINDENT
= EDINDENT("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);

   _EdSelect(wh, _EdGetLinePos(wh, 12), _EdGetLinePos(wh, 14));
   _EdIndent(wh, 1);
}
FoxInfo myFoxInfo[] = {
   {"EDINDENT", (FPFI) Example, 1, "C"},
};
FoxTable _FoxTable = {
   (FoxTable FAR *) 0, sizeof(myFoxInfo)/sizeof(FoxInfo), myFoxInfo
};

See Also

Reference

_EdGetLineNum( ) API Library Routine

_EdGetLinePos( ) API Library Routine

_EdGetPos( ) API Library Routine

_EdSetPos( ) API Library Routine

Other Resources

API Library Construction