Condividi tramite


_WScrollP( ) API Library Routine

Scrolls a portion of the contents of a window left or right and up or down.

void _WScrollP(WHANDLE wh, Rect r, int dv, int dh)
WHANDLE wh;            /* Window handle. */
Rect r;                     /* Portion to scroll. */
int dv;                        /* Left or right. */
int dh;                     /* Up or down. */

Remarks

  • The r parameter describes the portion of the window to be scrolled.
  • The dv parameter describes the number of pixels to scroll the window left or right. If dv is negative, the window contents scroll to the left. If dv is positive, the window contents scroll to the right.
  • The dh parameter describes the number of pixels to scroll the window up or down. If dh is negative, the window contents scroll up. If dh is positive, the window contents scroll down.

If both dv and dh are 0, _WScrollP( ) clears the characters inside the rectangle.

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 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
};

See Also

_WClear( ) API Library Routine | Accessing the Visual FoxPro API | _WPosCursor( ) API Library Routine | _WPutChr( ) API Library Routine