Jump to content

GpiSetCurrentPosition: Difference between revisions

From EDM2
Ak120 (talk | contribs)
 
(2 intermediate revisions by 2 users not shown)
Line 5: Line 5:


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


==Return Code==
==Return Code==
; rc (BOOL) - returns : Success indicator.
; rc (BOOL) - returns : Success indicator.
* TRUE Successful completion
:;TRUE  
* FALSE Error occurred.
::Successful completion
:;FALSE  
::Error occurred.


==Errors==  
==Errors==  
Line 31: Line 29:
; Element Type: '''OCODE_GSCP''' : This element type is generated if the attribute mode (see GpiSetAttrMode) is set to AM_NOPRESERVE.
; Element Type: '''OCODE_GSCP''' : This element type is generated if the attribute mode (see GpiSetAttrMode) is set to AM_NOPRESERVE.
Order: Set Current Position
Order: Set Current Position
; Element Type: '''OCODE_GPSCP''' : This element type is generated if the attribute mode is set to AM_PRESERVE.
; Element Type: '''OCODE_GPSCP''' : This element type is generated if the attribute mode is set to AM_PRESERVE.
Order: Push and Set Current Position
Order: Push and Set Current Position
Line 54: Line 51:
* [[GpiMove]]
* [[GpiMove]]
* [[GpiQueryCurrentPosition]]
* [[GpiQueryCurrentPosition]]
*GpiSetAttrMode
* [[GpiSetAttrMode]]
*GpiSetAttrs
* [[GpiSetAttrs]]
*GpiSetDefAttrs
* [[GpiSetDefAttrs]]


[[Category:Gpi]]
[[Category:Gpi]]

Latest revision as of 23:40, 7 April 2025

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