_EdActive( ) API Library Routine 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.
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
#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
};