_WScrollP( ) API Library Routine Example

The following example opens a window and draws a rectangular pattern of Xs. This rectangle is also the scroll rectangle. First, _WScrollP( ) scrolls the rectangle up and left. Next, it scrolls the rectangle down and right.

Visual FoxPro Code

SET LIBRARY TO WSCROLLP

C Code

#include <pro_ext.h>

FAR WScrollEx(ParamBlk FAR *parm)
{
   WHANDLE wh;
   Point pos;
   Rect rect;

   wh = _WOpenP(2, 2, 160, 320, WEVENT | CLOSE, WINDOW_SCHEME,
      (char *) 0, WO_SYSTEMBORDER);

  _WShow(wh);

   rect.top   = 40;
   rect.left   = 40;
   rect.bottom = 100;
   rect.right   = 100;

   for (pos.v = rect.top; pos.v < rect.bottom; pos.v += 6)
   {
      for (pos.h = rect.left; pos.h < rect.right; pos.h +=6)
      {
         _WPosCursorP(wh, pos);
    _WPutChr(wh, 'X');
      }
   }
   _Execute("WAIT 'Press any key to _WScroll(wh, rect, -20, -20)'");
   _WScrollP(wh, rect, -20, -20);
   _Execute("WAIT 'Press any key to _WScroll(wh, rect, +40, +40)'");
   _WScrollP(wh, rect, +40, +40);
}

FoxInfo myFoxInfo[] =
{
   {"ONLOAD", WScrollEx, CALLONLOAD, ""},
};

FoxTable _FoxTable =
{
   (FoxTable FAR *) 0, sizeof(myFoxInfo)/sizeof(FoxInfo), myFoxInfo
};