_WGetCursorP( ) API Library Routine Example
The following example creates a window and draws a diagonal pattern of Xs in this window. It positions the cursor before writing each X using _WPosCursorP( ), and gets that same position using _WGetCursorP( ).
SET LIBRARY TO WGETCURP
#include <pro_ext.h>
void putLong(long n, int width)
{
Value val;
val.ev_type = 'I';
val.ev_long = n;
val.ev_width = width;
_PutValue(&val);
}
FAR Example(ParamBlk FAR *parm)
{
WHANDLE wh;
Point putPos, getPos;
wh = _WOpen(4,4,20,70,0,WINDOW_SCHEME,(Scheme FAR *)0,
WO_SYSTEMBORDER);
_WShow(wh);
for (putPos.v = 10; putPos.v < 100; putPos.v += 10)
{
putPos.h = putPos.v;
_WPosCursorP(wh, putPos);
_WPutChr(wh, 'X');
getPos = _WGetCursorP(wh);
_PutStr("\nCursor position:");
putLong(getPos.v, 5);
putLong(getPos.h, 5);
_Execute("WAIT");
}
_WClose(wh);
}
FoxInfo myFoxInfo[] = {
{"ONLOAD", Example, CALLONLOAD, ""},
};
FoxTable _FoxTable = {
(FoxTable FAR *) 0, sizeof(myFoxInfo)/sizeof(FoxInfo), myFoxInfo
};