gpi12.hlp (Table of Contents; Topic list)
Important Notice
The pages on this site contain documentation for very old MS-DOS software, purely for historical purposes. If you're looking for up-to-date documentation, particularly for programming, you should not rely on the information found here, as it will be woefully out of date.
GpiOffsetElementPointer (1.2)
Function Group  Overview                          Up Next Previous
────────────────────────────────────────────────────────────────────────────
 
#define INCL_GPISEGEDITING
 
BOOL GpiOffsetElementPointer(hps, off)
HPS hps;     /* presentation-space handle        */
LONG off;    /* offset to add to element pointer */
 
The GpiOffsetElementPointer function moves the element pointer by the number
of elements specified by the off parameter. The function starts the move at
the current element-pointer position, and moves the element pointer either
toward the beginning or end of the segment, depending on whether off is
negative or positive. If off specifies more elements than actually exist
between the current position and the beginning or end, the function sets the
element pointer to zero or to the last element in the segment, depending on
the direction of the move.
 
The GpiOffsetElementPointer function affects the current open segment. If no
segment is open, the function is ignored. Also, the function cannot be used
in an element bracket.
 
Parameter  Description
────────────────────────────────────────────────────────────────────────────
 
hps        Identifies the presentation space.
 
off        Specifies the offset to be added to the element pointer.
 
Return Value
 
The return value is GPI_OK if the function is successful or GPI_ERROR if an
error occurred.
 
Errors
 
Use the WinGetLastError function to retrieve the error value, which may be
one of the following:
 
     PMERR_INV_HPS
     PMERR_INV_IN_ELEMENT
     PMERR_INV_MICROPS_FUNCTION
     PMERR_NO_CURRENT_GRAPHICS_SEG
     PMERR_NOT_IN_RETAIN_MODE
     PMERR_PS_BUSY
 
Example
 
This example uses the GpiOffsetElementPointer function to move to the
element associated with a label element. Combining the
GpiSetElementPointerAtLabel and GpiOffsetElementPointer functions is a
convenient way to locate elements in segments that have been edited.
 
POINTL ptlStart = { 0, 0 };
POINTL ptlTriangle[] = { 100, 100, 200, 0, 0, 0 };
 
GpiOpenSegment(hps, 4L);         /* creates a segment with labels */
GpiLabel(hps, 5L);   GpiMove(hps, &ptlStart);
GpiLabel(hps, 10L);  GpiPolyLine(hps, 3L, ptlTriangle);
GpiCloseSegment(hps);
    .
    .
    .
GpiOpenSegment(hps, 4L);
GpiSetElementPointerAtLabel(hps, 10L) /* move to label 10         */
GpiOffsetElementPointer(hps, 1L);     /* move to polyline element */
 
See Also
 
GpiSetEditMode, GpiSetElementPointer, GpiSetElementPointerAtLabel,
WinGetLastError