Jump to content

GpiLabel: Difference between revisions

From EDM2
Created page with "==Description== This function generates an element containing the specified label. ==Syntax== <PRE> #define INCL_GPISEGEDITING Or use INCL_GPI, INCL_PM,: #include <os2.h..."
 
m Martini moved page OS2 API:GPI:GpiLabel to GpiLabel
(No difference)

Revision as of 23:38, 17 November 2016

Description

This function generates an element containing the specified label.

Syntax

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

HPS     hps;     /*  Presentation-space handle. */
LONG    lLabel;  /*  Required label. */
BOOL    rc;      /*  Success indicator. */

rc = GpiLabel(hps, lLabel);

Parameters

hps (HPS) - input
Presentation-space handle.
lLabel (LONG) - input
Required label.

No check is made on the value of this parameter.


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_MICROPS_FUNCTION (0x20A1)

       An attempt was made to issue a function that is invalid in a micro presentation space. 

PMERR_INV_IN_ELEMENT (0x2089)

       An attempt was made to issue a function invalid inside an element bracket.

Remarks

This function has no effect unless a retained segment is being constructed. It is invalid within an element bracket. Duplicate labels within a segment are allowed.

Example Code

This example uses the GpiLabel function to create label elements in a segment. If the segment is subsequently edited, the label elements can still be used to locate the elements near it.

#define INCL_GPISEGEDITING      /* GPI Segment Edit 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);          /* creates a segment */
GpiLabel(hps, 5L);                /* creates label 5   */
GpiLabel(hps, 10L);               /* creates label 10  */
GpiMove(hps, &ptlStart);
GpiCloseSegment(hps);
GpiPolyLine(hps, 3L, ptlTriangle);

Graphic Elements and Orders

Element Type: OCODE_GLABL

   Order: Label

Related Functions

  • GpiSetElementPointerAtLabel
  • GpiSetTag