Functions and Directives

Function GraPos() Foundation

Determines pen position or moves pen.

Syntax
GraPos( [<oPS>], [ <aPoint> ] ) --> aPenPosition
Parameters
<oPS>
The argument <oPS> specifies the presentation space in which the pen position is determined or reset. If the current window is an XbpCrt window, <oPS>is optional. If it is NIL, the return value of SetAppWindow():presSpace() is used. In all other cases <oPS> is not optional. It must be created either using XbpPresSpace():new() or a "Micro PS" must be requested from an Xbase Part using the method :lockPS(). After graphic output the Micro PS must be released with :unlockPS().
<aPoint> := { <nX>, <nY> }
<aPoint> is an array of two elements which contains the coordinates for the pen position as numeric values. The first element <nX>specifies the x coordinate and the second element <nY> specifies the y coordinate for the pen position. The unit for the coordinates depends on the coordinate system defined for the presentation space. If no presentation space is specified, the values for the coordinates are indicated in pixels, which is the unit for a window. The origin for the coordinates (the point {0,0}) is at the lower left.
Return

The return value of GraPos() is an array of two elements which contains the coordinates for the pen position before the call of GraPos() (as <aPoint>).

Description

Each presentation space is provided with a pen for the output of graphic functions. When lines are drawn, the pen position changes. That is analogous to a change of position of the screen cursor when characters are output on the screen in text mode. GraPos() determines the current pen position or repositions the pen. The current pen position is used by most graphic primitives when an optional start coordinate is not specified.

Examples
Positioning the drawing pen
// The example shows the use of GraPos() and how 
// the function GraLine() affects the pen position. 

PROCEDURE Main 
   LOCAL aPoint 

   SetColor("N/W")                  // fill window with pale gray 
   CLS 

   aPoint := GraPos()               // aPoint is {0,0} 

   GraLine(,,{100,200} )            // draw line from {0,0} 
                                    // to {100,200} 
   aPoint := GraPos()               // aPoint is {100,200} 

RETURN 
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.