Method XbpWindow():invalidateRect() Foundation

Mark a window area as invalid (for redraw).

Syntax
:invalidateRect( [<aRectangle>], [<lChilds>], [<nRgnOp>] ) --> lSuccess
Parameters
<aRectangle> := { nX1, nY1, nX2, nY2 }
<aRectangle> is an array containing four coordinates. These coordinates indicate the position of the lower left and the upper right corners of the area in the window defined as invalid. The coordinates are relative to the lower left corner of the window. The default coordinates indicate the entire area of a window.
<lChilds>
<lChilds> is a logical value that defines whether child objects of the window are invalidated as well. This parameter is optional and defaults to the value .T. (true). If .F. (false) is assigned to this parameter, childs of the XbpWindow object are excluded from invalidation and are not redrawn.
The optional <nRgnOp> parameter may be used to specify a region operator to be applied to the area specified in <aRectangle>. If a value other than the constant XBP_INVREGION_DISCARD is passed in <nRgnOp>, no immediate redraw occurs. Instead, the rectangle specified in <aRectangle> is combined with the existing invalid region. This allows to use several calls to :invalidateRect() to define a complex area for redraw, such as a frame or hilight mark drawn around an Xbase Part.
Region operators for manipulating the invalid area
Constant Description
XBP_INVREGION_LOCK Region is locked for manipulation, redraw is issued upon release. <aRectangle> specifies the initial invalid region.
XBP_INVREGION_DISCARD *) Current invalid region is discarded. If no region is locked using XBP_INVREGION_LOCK, the complete area in <aRectangle> is redrawn.
XBP_INVREGION_RELEASE The invalid region is released and redrawn. May be combined with one of the logical region operators.
XBP_INVREGION_AND New invalid region is the intersection of the current region with the area specified in <aRectangle>.
XBP_INVREGION_OR New invalid region is the union of the current region and the area specified in <aRectangle>.
XBP_INVREGION_XOR Same as XBP_INVREGION_OR, but overlapping areas are excluded.
XBP_INVREGION_DIFF New invalid region is the current region with the area specified in <aRectangle> excluded.
  1. Default value
The default value for the <nRgnOp> parameter is the constant XBP_INVREGION_DISCARD, which causes an immediate redraw of the area specified in the <aRectangle> parameter.
Return

This method returns the value .T. (true) if the specified area could be marked as invalid, otherwise it returns .F. (false).

Description

The method :invalidateRect() specifies a rectangular area of the Xbase Part as invalid. This causes the area to be redrawn and the event xbeP_Paint to be generated. The following example code would completely invalidate an Xbase Part causing it to be entirely redrawn:

oXbp:invalidateRect() 

To redraw only parts of an Xbase Part, several calls to method :invalidateRect() may be combined to define the invalid area. The following code snippet invalidates the rectangle {50,50,150,150}. However, the inside of the rectangle is not redrawn. Instead, a logical XOR operator is applied to exclude parts of the rectangle from the invalid region.

// Specify initial rectangle to redraw and 
// lock the invalid region 
oxbp:invalidaterect( {50,50,150,150},, XBP_INVREGION_LOCK ) 

// Exclude the inside of the rectangle from 
// the invalid region and redraw 
oxbp:invalidaterect( {60,60,140,140},, XBP_INVREGION_XOR + XBP_INVREGION_RELEASE ) 

Feedback

If you see anything in the documentation that is not correct, does not match your experience with the particular feature or requires further clarification, please use this form to report a documentation issue.