Condividi tramite


_WPosCursor( ) API Library Routine

Positions the output position in the specified window at the location specified in rows and columns by pt.

void _WPosCursor(WHANDLE wh, Point pt)
WHANDLE wh;            /* Window handle. */
Point pt;                     /* Location for the output position. */

Remarks

_WPosCursor( ) doesn't make the insertion point appear. Normally, the insertion point is visible only when Visual FoxPro is waiting for input.

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 creates a window and draws a diagonal pattern of Xs in this window. It positions the cursor before writing each X using _WPosCursor( ), and gets that same position using _WGetCursor( ).

Visual FoxPro Code

SET LIBRARY TO WPOSCUR 

C Code

#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 = 2; putPos.v < 14; putPos.v++)
   {
      putPos.h = putPos.v;

      _WPosCursor(wh, putPos);
      _WPutChr(wh, 'X');

      getPos = _WGetCursor(wh);

      _PutStr("\nCursor position:");
      putLong(getPos.v, 5);
      putLong(getPos.h, 5);

      _Execute("WAIT");
   }
   _WClose(wh);
}
FoxInfo myFoxInfo[] = {
   {"ONLOAD", (FPFI) Example, CALLONLOAD, ""},
};
FoxTable _FoxTable = {
   (FoxTable FAR *) 0, sizeof(myFoxInfo)/sizeof(FoxInfo), myFoxInfo
};

See Also

_WGetCursor( ) | Accessing the Visual FoxPro API | _WPosCursorP( ) API Library Routine | _WPutChr( ) API Library Routine | _WPutStr( ) API Library Routine