Jump to content

GpiSetEditMode

From EDM2
Revision as of 22:54, 6 April 2025 by Iturbide (talk | contribs) (Created page with "This function sets the current editing mode. ==Syntax== GpiSetEditMode(hps, lMode) ==Parameters== ; hps (HPS) - input : Presentation-space handle. ; lMode (LONG) - input : Edit mode. :; SEGEM_INSERT :: Insert mode :; SEGEM_REPLACE :: Replace mode. ==Return Value== ; rc (BOOL) - returns : Success indicator. :; TRUE :: Successful completion :; FALSE :: Error occurred. ==Remarks== This function determines whether a new element is to be inserted into a segm...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

This function sets the current editing mode.

Syntax

GpiSetEditMode(hps, lMode)

Parameters

hps (HPS) - input
Presentation-space handle.
lMode (LONG) - input
Edit mode.
SEGEM_INSERT
Insert mode
SEGEM_REPLACE
Replace mode.

Return Value

rc (BOOL) - returns
Success indicator.
TRUE
Successful completion
FALSE
Error occurred.

Remarks

This function determines whether a new element is to be inserted into a segment, moving any subsequent elements further along the segment, or whether a new element is to replace the current element.

In SEGEM_INSERT mode, when an element is generated, it is inserted following the element indicated by the element pointer. The element pointer is updated to point to the new element.

In SEGEM_REPLACE mode, when an element is generated, it replaces the element indicated by the element pointer. The element pointer does not change. It is an error if a new element is generated in SEGEM_REPLACE mode if the element pointer is 0 (as it is when a segment is opened).

The editing mode can be changed at any time, (except while within an element bracket), and is not an attribute of a specific segment. It only applies to the storing of data within retained segments. It is not an error to issue this function in other drawing modes; the value of the edit mode is set irrespective of the value of the draw mode.

This function is invalid within an element bracket. The default editing mode (set by GpiCreatePS or GpiResetPS) is SEGEM_INSERT.

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_EDIT_MODE (0x2069)
An invalid mode parameter was specified with GpiSetEditMode.
PMERR_INV_IN_ELEMENT (0x2089)
An attempt was made to issue a function invalid inside an element bracket.
PMERR_INV_MICROPS_FUNCTION (0x20A1)
An attempt was made to issue a function that is invalid in a micro presentation space.

Example Code

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

HPS  hps;   /* Presentation-space handle. */
LONG lMode; /* Edit mode. */
BOOL rc;    /* Success indicator. */

rc = GpiSetEditMode(hps, lMode);

This example sets the current editing mode to insert.

#define INCL_GPISEGEDITING
#include <OS2.H>

HPS hps; /* Presentation-space */
/* handle. */

GpiSetEditMode(hps, SEGEM_INSERT); /* insert mode. */

Related Functions