GpiLabel: Difference between revisions
Appearance
No edit summary |
|||
(4 intermediate revisions by 3 users not shown) | |||
Line 1: | Line 1: | ||
This function generates an element containing the specified label. | This function generates an element containing the specified label. | ||
==Syntax== | ==Syntax== | ||
GpiLabel (hps, lLabel) | |||
==Parameters== | ==Parameters== | ||
;hps ([[HPS]]) - input : Presentation-space handle. | |||
; hps (HPS) - input : Presentation-space handle. | ;lLabel ([[LONG]]) - input : Required label. | ||
:No check is made on the value of this parameter. | |||
; lLabel (LONG) - input : Required label. | |||
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 | |||
TRUE | ::Successful completion | ||
:;FALSE | |||
::Error occurred. | |||
FALSE | |||
===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) | ;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. | |||
PMERR_PS_BUSY (0x20F4) | |||
PMERR_INV_MICROPS_FUNCTION (0x20A1) | |||
PMERR_INV_IN_ELEMENT (0x2089) | |||
==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== | ||
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. | 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. | ||
<PRE> | <PRE> | ||
#define INCL_GPISEGEDITING /* GPI Segment Edit functions */ | #define INCL_GPISEGEDITING /* GPI Segment Edit functions */ | ||
Line 67: | Line 42: | ||
GpiCloseSegment(hps); | GpiCloseSegment(hps); | ||
GpiPolyLine(hps, 3L, ptlTriangle); | GpiPolyLine(hps, 3L, ptlTriangle); | ||
</PRE> | </PRE> | ||
==Graphic Elements and Orders== | ==Graphic Elements and Orders== | ||
;Element Type: OCODE_GLABL | |||
:Order: Label | |||
==Related Functions== | ==Related Functions== | ||
* [[GpiSetElementPointerAtLabel]] | *[[GpiSetElementPointerAtLabel]] | ||
* [[GpiSetTag]] | *[[GpiSetTag]] | ||
[[Category: | [[Category:Gpi]] |
Latest revision as of 23:50, 7 April 2025
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