Difference between revisions of "GpiMove"

From EDM2
Jump to: navigation, search
(Related Functions)
Line 77: Line 77:
 
* [[GpiSetCurrentPosition]]
 
* [[GpiSetCurrentPosition]]
  
[[Category:GPI]]
+
[[Category:Gpi]]

Revision as of 21:56, 20 January 2017

Description

This function moves the current position to the specified point.

Syntax

#define INCL_GPIPRIMITIVES /* Or use INCL_GPI, INCL_PM, Also in COMMON section */
#include <os2.h>

HPS        hps;        /*  Presentation-space handle. */
PPOINTL    pptlPoint;  /*  Position to which to move. */
BOOL       rc;         /*  Success indicator. */

rc = GpiMove(hps, pptlPoint);


Parameters

hps (HPS) - input 
Presentation-space handle.
pptlPoint (PPOINTL) - input 
Position to which to move.

This position is in world coordinates.

Return Code

rc (BOOL) - returns 
Success indicator.

TRUE

       Successful completion 

FALSE

       Error occurred.

Errors

Possible returns from WinGetLastError

PMERR_INV_HPS (0x207F)

       An invalid presentation-space handle was specified. 

PMERR_PS_BUSY (0x20F4)

       An attempt was made to access the presentation space from more than one thread simultaneously. 

PMERR_INV_COORDINATE (0x205B)

       An invalid coordinate value was specified.

Remarks

This function also has the effect of resetting position within a line-type sequence, and, if within an area, of starting a new closed figure and causing any previous one to be closed automatically if necessary.

This function is equivalent to the GpiSetCurrentPosition call, except that, if the current attribute mode is AM_PRESERVE (see GpiSetAttrMode), the current position is not saved before being set to a new value by the GpiMove function, and hence cannot be restored using the GpiPop call.

Example Code

This example uses the GpiMove function to draw an X. The function moves the current position to the starting point of each leg of the character.

#define INCL_GPIPRIMITIVES      /* GPI primitive functions      */
#include <os2.h>

HPS hps;                /* presentation space handle            */
/* point array */
POINTL ptl[4] = { 0, 0, 100, 100, 0, 100, 100, 0 };

GpiMove(hps, &ptl[0]);    /* move to (0,0)   */
GpiLine(hps, &ptl[1]);
GpiMove(hps, &ptl[2]);    /* move to (0,100) */
GpiLine(hps, &ptl[3]);

Graphic Elements and Orders

Element Type: OCODE_GSCP

   Note that GpiSetCurrentPosition also generates this element type.

   Order: Set Current Position

Related Functions