Partager via


_EdActive( ) API Library Routine

Allows you to hide (deactivate) or show (activate) the selection range or the insertion point position in the specified window.

void _EdActive(WHANDLE wh, int Show)
WHANDLE wh;            /* Handle of editing window.*/
int Show;                     /* Boolean hide or show selection. */

Remarks

Specifying the Show parameter as TRUE shows the selection range or insertion point position, and specifying Show as FALSE hides the selection range or insertion point position.

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 edit window for a file whose name is passed as a parameter and selects the first character in the file. Using _EdActive( ), the example activates and then deactivates the selection.

Visual FoxPro Code

SET LIBRARY TO EDACTIVE
fc = FCREATE("x", 0)
FOR i = 1 TO 90
   = FPUTS(fc, REPL(ALLT(STR(i)), i), i)
ENDFOR
= FCLOSE(fc)

= EDACTIVE("x")   && Call our API routine

C Code

#include <pro_ext.h>

FAR EdActiveEx(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"
   }
   _HLock(parm->p[0].val.ev_handle);
   pFILENAME[parm->p[0].val.ev_length] = '\0';
   wh = _EdOpenFile(pFILENAME, FO_READONLY);
   _HUnLock(parm->p[0].val.ev_handle);

   _EdSelect(wh, 0, 1);

   _EdActive(wh, TRUE);
   _Execute("WAIT WINDOW 'Selection active'");

   _EdActive(wh, FALSE);
   _Execute("WAIT WINDOW 'Selection inactive'");
}

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

See Also

Reference

_EdSelect( ) API Library Routine

_EdCloseFile( ) API Library Routine

SYS(2002) - Turn Insertion Point On or Off

_EdCopy( ) API Library Routine

Other Resources

API Library Construction