Jump to content

GpiDeleteSegment

From EDM2
Revision as of 22:43, 6 April 2025 by Iturbide (talk | contribs) (Created page with "This function deletes a retained segment. ==Syntax== GpiDeleteSegment(hps, lSegid) ==Parameters== ; hps (HPS) - input : Presentation-space handle. ; lSegid (LONG) - input : Segment identifier. : The identifier of the segment to be deleted; it must be greater than 0. ==Return Value== ; rc (BOOL) - returns : Success indicator. :; TRUE :: Successful completion :; FALSE :: Error occurred. ==Remarks== If the segment is open when it is deleted, there is no op...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

This function deletes a retained segment.

Syntax

GpiDeleteSegment(hps, lSegid)

Parameters

hps (HPS) - input
Presentation-space handle.
lSegid (LONG) - input
Segment identifier.
The identifier of the segment to be deleted; it must be greater than 0.

Return Value

rc (BOOL) - returns
Success indicator.
TRUE
Successful completion
FALSE
Error occurred.

Remarks

If the segment is open when it is deleted, there is no open segment after this function. In this instance, processing as described for GpiCloseSegment is performed. If the segment is in the segment chain, it is removed from the chain. This function deletes only a retained segment. Note: In draw drawing mode (see GpiSetDrawingMode), the identifier of the current segment is not remembered, so it is not recognized if specified as the lSegid parameter.

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_SEG_NAME (0x20C8)
An invalid segment identifier was specified.
PMERR_INV_MICROPS_FUNCTION (0x20A1)
An attempt was made to issue a function that is invalid in a micro presentation space.

Example Code

#define INCL_GPISEGMENTS /* Or use INCL_GPI, INCL_PM, */
#include <os2.h>

HPS  hps;    /* Presentation-space handle. */
LONG lSegid; /* Segment identifier. */
BOOL rc;     /* Success indicator. */

rc = GpiDeleteSegment(hps, lSegid);

This example uses the GpiDeleteSegment function to delete segment 4, previously created by GpiOpenSegment.

#define INCL_GPISEGMENTS /* Segment functions */
#include <os2.h>

HPS hps; /* presentation space handle */
POINTL ptlStart = { 0, 0 }; /* first vertex */
POINTL ptlTriangle[] = { 100, 100, 200, 0, 0, 0 }; /* vertices */

GpiOpenSegment(hps, 4L); /* open the segment */
GpiMove(hps, &ptlStart); /* move to start point (0, 0) */
GpiPolyLine(hps, 3L, ptlTriangle); /* draw triangle */
GpiCloseSegment(hps); /* close the segment */

.
.
.

GpiDeleteSegment(hps, 4L); /* delete segment #4 */

Related Functions