Jump to content

GpiLabel: Difference between revisions

From EDM2
Ak120 (talk | contribs)
mNo edit summary
Ak120 (talk | contribs)
mNo edit summary
Line 7: Line 7:
;hps (HPS) - input : Presentation-space handle.
;hps (HPS) - input : Presentation-space handle.
;lLabel (LONG) - input : Required label.
;lLabel (LONG) - input : Required label.
No check is made on the value of this parameter.
:No check is made on the value of this parameter.


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


===Errors===
===Errors===
Possible returns from WinGetLastError
Possible returns from WinGetLastError:
;PMERR_INV_HPS (0x207F):An invalid presentation-space handle was specified.  
: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_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_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.
:PMERR_INV_IN_ELEMENT (0x2089): An attempt was made to issue a function invalid inside an element bracket.


==Remarks==
==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.  
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==
==Example Code==
Line 44: Line 44:
==Graphic Elements and Orders==
==Graphic Elements and Orders==
Element Type: OCODE_GLABL
Element Type: OCODE_GLABL
 
Order: Label
Order: Label



Revision as of 22:16, 30 July 2020

This function generates an element containing the specified label.

Syntax

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