You can use editing functions to:
The following figure shows an example of how to edit the contents of a segment. In the example, three elements are inserted. The steps required for this task are as follows:
#define INCL_GPISEGEDITING#define INCL_GPICONTROL
#include <os2.h>
void fncESEG01(void){
HPS hps;
LONG idNonChained;
POINTL ptl;
GpiSetEditMode(hps, SEGEM_INSERT);
GpiSetDrawingMode(hps, DM_RETAIN);
GpiOpenSegment(hps, idNonChained);
GpiSetElementPointer(hps, 0L);
GpiSetColor(hps, CLR_YELLOW);
ptl.x = 100; ptl.y = 100;
GpiMove(hps, &ptl);
ptl.x = 150; ptl.y = 150;
GpiBox(hps, DRO_OUTLINE, &ptl, 40L, 40L);
ptl.x = 30; ptl.y = 30;
GpiMove(hps, &ptl);
GpiSetElementPointer(hps, 5L);
GpiDeleteElement(hps);
GpiCloseSegment(hps);
} /* fncESEG01 */
The first element inserted contains the graphics order that sets the color to yellow; the second element moves the current position; and the third element draws an outlined box with rounded corners. After the three elements are inserted, the code deletes the element at position 5 in the segment (this element was previously at positions 1 and 2).