GpiDeleteElementRange: Difference between revisions
Appearance
Created page with "This function deletes all elements between, and including, the elements indicated by the specified element numbers. ==Syntax== GpiDeleteElementRange(hps, lFirstElement, lLastElement) ==Parameters== ; hps (HPS) - input : Presentation-space handle. ; lFirstElement (LONG) - input : Number of the first element to be deleted. : If lFirstElement > lLastElement, the values are swapped before being used. ; lLastElement (LONG) - input : Number of the last element..." |
No edit summary |
||
Line 43: | Line 43: | ||
; PMERR_INV_IN_ELEMENT (0x2089) | ; PMERR_INV_IN_ELEMENT (0x2089) | ||
: An attempt was made to issue a function invalid inside an element bracket. | : An attempt was made to issue a function invalid inside an element bracket. | ||
==Example Code== | ==Example Code== | ||
Line 83: | Line 69: | ||
GpiCloseSegment(hps); /* close the segment */ | GpiCloseSegment(hps); /* close the segment */ | ||
</pre> | </pre> | ||
==Related Functions== | |||
* [[GpiBeginElement]] | |||
* [[GpiDeleteElement]] | |||
* [[GpiDeleteElementsBetweenLabels]] | |||
* [[GpiElement]] | |||
* [[GpiEndElement]] | |||
* [[GpiLabel]] | |||
* [[GpiOffsetElementPointer]] | |||
* [[GpiQueryElement]] | |||
* [[GpiQueryElementPointer]] | |||
* [[GpiQueryElementType]] | |||
* [[GpiSetElementPointer]] | |||
* [[GpiSetElementPointerAtLabel]] | |||
[[Category:Gpi]] | [[Category:Gpi]] |
Latest revision as of 22:33, 6 April 2025
This function deletes all elements between, and including, the elements indicated by the specified element numbers.
Syntax
GpiDeleteElementRange(hps, lFirstElement, lLastElement)
Parameters
- hps (HPS) - input
- Presentation-space handle.
- lFirstElement (LONG) - input
- Number of the first element to be deleted.
- If lFirstElement > lLastElement, the values are swapped before being used.
- lLastElement (LONG) - input
- Number of the last element to be deleted.
- If lLastElement < lFirstElement, the values are swapped before being used.
Return Value
- rc (BOOL) - returns
- Success indicator.
- TRUE
- Successful completion
- FALSE
- Error occurred.
Remarks
If either element number is outside the range of the current segment, it is set to the nearest valid value. When this function has finished, the element pointer is set to the element immediately preceding the deleted element or elements. This function is only valid when the drawing mode (see GpiSetDrawingMode) is set to retain (not draw-and-retain), and a segment bracket is currently in progress. It is not valid within an element bracket.
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_NOT_IN_RETAIN_MODE (0x20E2)
- An attempt was made to issue a segment editing element function that is invalid when the actual drawing mode is not set to retain.
- PMERR_NO_CURRENT_SEG (0x20E6)
- An attempt has been made to issue GpiQueryElementType or GpiQueryElement while there is no currently open segment.
- PMERR_INV_IN_ELEMENT (0x2089)
- An attempt was made to issue a function invalid inside an element bracket.
Example Code
#define INCL_GPISEGEDITING /* Or use INCL_GPI, INCL_PM, */ #include <os2.h> HPS hps; /* Presentation-space handle. */ LONG lFirstElement; /* Number of the first element to be deleted. */ LONG lLastElement; /* Number of the last element to be deleted. */ BOOL rc; /* Success indicator. */ rc = GpiDeleteElementRange(hps, lFirstElement, lLastElement);
This example uses the GpiDeleteElementRange function to delete the second through fifth elements in the previously created segment 2.
#define INCL_GPISEGEDITING /* GPI Segment Edit functions */ #include <os2.h> HPS hps; GpiOpenSegment(hps, 2L); /* open segment # 2 */ GpiDeleteElementRange(hps, 2L, 5L);/* delete elements 2 thru 5 */ GpiCloseSegment(hps); /* close the segment */