_WScroll( ) 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, the example scrolls the rectangle up two positions and to the left two positions. Next, it scrolls the rectangle down by four positions and to the right four positions.

Visual FoxPro Code

SET LIBRARY TO WSCROLL 

C Code

#include <pro_ext.h>

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

   wh = _WOpen(2,2,20,70,WEVENT | CLOSE,WINDOW_SCHEME,(Scheme FAR *) 0,
      WO_SYSTEMBORDER);
   _WShow(wh);

   rect.top   = 6;
   rect.left   = 6;
   rect.bottom = 12;
   rect.right   = 12;

   for (pos.v = rect.top; pos.v < rect.bottom; pos.v++)
   {
      for (pos.h = rect.left; pos.h < rect.right; pos.h++)
      {
         _WPosCursor(wh, pos);
         _WPutChr(wh, 'X');
      }
   }
   _Execute("WAIT WINDOW 'Press any key to _WScroll(wh,rect,-2,-2)'");
   _WScroll(wh, rect, -2, -2);
   _Execute("WAIT WINDOW 'Press any key to _WScroll(wh,rect,+4,+4)'");
   _WScroll(wh, rect, +4, +4);
}

FoxInfo myFoxInfo[] = {
   {"ONLOAD", (FPFI) WScrollEx, CALLONLOAD, ""},
};
FoxTable _FoxTable = {
   (FoxTable FAR *) 0, sizeof(myFoxInfo)/sizeof(FoxInfo), myFoxInfo
};