Jump to content

GpiSetCurrentPosition

From EDM2
Revision as of 23:20, 24 August 2018 by Ak120 (talk | contribs)

This function sets the current position to the specified point.

Syntax

GpiSetCurrentPosition (hps, pptlPoint)

Parameters

hps (HPS) - input
Presentation-space handle.
pptlPoint (PPOINTL) - input
New value of current position.

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 the 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 if necessary.

This function is equivalent to the GpiMove function except that, if the current attribute mode is AM_PRESERVE (see GpiSetAttrMode), the current position is saved before being set to the new value, so that it can be restored using the GpiPop function.

Graphic Elements and Orders

Element Type
OCODE_GSCP : This element type is generated if the attribute mode (see GpiSetAttrMode) is set to AM_NOPRESERVE.

Order: Set Current Position

Element Type
OCODE_GPSCP : This element type is generated if the attribute mode is set to AM_PRESERVE.

Order: Push and Set Current Position

Example Code

The position of the top-left corner of the window rectangle is recorded and selected as the current position before the image is drawn.

#define INCL_GPIPRIMITIVES
#include <OS2.H>
HPS hps;           /* Presentation space handle */
HWND hwndClient;   /* client window handle. */
RECTL rcl;
POINTL vptlSave;

WinQueryWindowRect(hwndClient, &rcl);
vptlSave.x = rcl.xLeft;
vptlSave.y = rcl.yTop;
GpiSetCurrentPosition(hps, &vptlSave);

Related Functions