_WClearRectP( ) API Library Routine

Erases the specified rectangular area of a window by changing it to the default background color.

void _WClearRectP(WHANDLE wh, Rect r)
WHANDLE wh;            /* Window handle. */
Rect r;                     /* Rectangle to clear. */

Remarks

The rectangular area is specified in pixels. The output position is unchanged.

The area of the rectangle extends from the top left position to, but not including, the bottom right position. This means that you should declare the bottom and right positions to be one pixel more than the intended size of 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 creates a window and fills it with Xs. After the user presses a key in response to the Visual FoxPro WAIT command, _WClearRectP( ) clears a rectangular region of the window.

Visual FoxPro Code

SET LIBRARY TO WCLRECTP 

C Code

#include <pro_ext.h>

FAR WClearEx(ParamBlk FAR *parm)
{
   WHANDLE wh;
   int row, col;
   Rect r;

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

   for (row = 0; row < _WHeight(wh); row++)
   {
      for (col = 0; col < _WWidth(wh); col++)
      {
         _WPutChr(wh, 'X');
      }
   }
   _Execute("WAIT WINDOW 'Press any key to clear window rectangle'");

   r.top    = 20;
   r.left    = 20;
   r.bottom = 100;
   r.right  = 300;

   _WClearRectP(wh, r);
}

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

See Also

Reference

_WClear( ) API Library Routine
WAIT Command
_WClearRect( ) API Library Routine

Other Resources

API Library Construction
Accessing the Visual FoxPro API