Jump to content

GpiSetSegmentAttrs: Difference between revisions

From EDM2
Created page with "This function sets a segment attribute. ==Syntax== GpiSetSegmentAttrs(hps, lSegid, lAttribute, lValue) ==Parameters== ; hps (HPS) - input : Presentation-space handle. ; lSegid (LONG) - input : Segment identifier. : The identifier of the segment whose attribute is to be updated. It must be greater than zero. ; lAttribute (LONG) - input : Segment attribute. : For details of the following attributes, see the GpiSetInitialSegmentAttrs function. :; ATTR_D..."
 
Ak120 (talk | contribs)
mNo edit summary
Line 5: Line 5:


==Parameters==
==Parameters==
; hps ([[HPS]]) - input
; hps ([[HPS]]) - input: Presentation-space handle.
: Presentation-space handle.
; lSegid ([[LONG]]) - input: Segment identifier.
 
; lSegid ([[LONG]]) - input
: Segment identifier.
: The identifier of the segment whose attribute is to be updated. It must be greater than zero.
: The identifier of the segment whose attribute is to be updated. It must be greater than zero.
 
; lAttribute (LONG) - input: Segment attribute.
; lAttribute ([[LONG]]) - input
: Segment attribute.
: For details of the following attributes, see the [[GpiSetInitialSegmentAttrs]] function.
: For details of the following attributes, see the [[GpiSetInitialSegmentAttrs]] function.
:; ATTR_DETECTABLE
::ATTR_DETECTABLE: Detectability
:: Detectability
::ATTR_VISIBLE: Visibility
:; ATTR_VISIBLE
::ATTR_CHAINED: Chained
:: Visibility
::ATTR_DYNAMIC: Dynamic
:; ATTR_CHAINED
::ATTR_FASTCHAIN: Fast chaining
:: Chained
::ATTR_PROP_DETECTABLE: Propagate detectability
:; ATTR_DYNAMIC
::ATTR_PROP_VISIBLE: Propagate visibility.
:: Dynamic
; lValue ([[LONG]]) - input: Attribute value.
:; ATTR_FASTCHAIN
::ATTR_ON: On/yes
:: Fast chaining
::ATTR_OFF: Off/no.
:; ATTR_PROP_DETECTABLE
:: Propagate detectability
:; ATTR_PROP_VISIBLE
:: Propagate visibility.
 
; lValue ([[LONG]]) - input
: Attribute value.
:; ATTR_ON
:: On/yes
:; ATTR_OFF
:: Off/no.


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


==Remarks==
==Remarks==
Line 56: Line 37:
==Errors==
==Errors==
Possible returns from WinGetLastError:
Possible returns from WinGetLastError:
; PMERR_INV_HPS (0x207F)
; PMERR_INV_HPS (0x207F): An invalid presentation-space handle was specified.
: 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)
; PMERR_INV_SEG_NAME (0x20C8): An invalid segment identifier was specified.
: An attempt was made to access the presentation space from more than one thread simultaneously.
; PMERR_INV_SEG_ATTR (0x20C5): An invalid attribute parameter was specified with GpiSetSegmentAttrs, [[GpiQuerySegmentAttrs]], [[GpiSetInitialSegmentAttrs]], or [[GpiQueryInitialSegmentAttrs]].
; PMERR_INV_SEG_NAME (0x20C8)
; PMERR_INV_SEG_ATTR_VALUE (0x20C6): An invalid attribute value parameter was specified with GpiSetSegmentAttrs or [[GpiSetInitialSegmentAttrs]].
: An invalid segment identifier was specified.
; PMERR_SEG_NOT_FOUND (0x2100): The specified segment identifier did not exist.
; PMERR_INV_SEG_ATTR (0x20C5)
; PMERR_INV_MICROPS_FUNCTION (0x20A1): An attempt was made to issue a function that is invalid in a micro presentation space.
: An invalid attribute parameter was specified with GpiSetSegmentAttrs, [[GpiQuerySegmentAttrs]], [[GpiSetInitialSegmentAttrs]], or [[GpiQueryInitialSegmentAttrs]].
; PMERR_INV_SEG_ATTR_VALUE (0x20C6)
: An invalid attribute value parameter was specified with GpiSetSegmentAttrs or [[GpiSetInitialSegmentAttrs]].
; PMERR_SEG_NOT_FOUND (0x2100)
: The specified segment identifier did not exist.
; PMERR_INV_MICROPS_FUNCTION (0x20A1)
: An attempt was made to issue a function that is invalid in a micro presentation space.


==Example Code==
==Example Code==
<PRE>
#define INCL_GPISEGMENTS /* Or use INCL_GPI, INCL_PM, */
#include &lt;os2.h&gt;
HPS  hps;        /* Presentation-space handle. */
LONG lSegid;    /* Segment identifier. */
LONG lAttribute; /* Segment attribute. */
LONG lValue;    /* Attribute value. */
BOOL rc;        /* Success indicator. */
rc = GpiSetSegmentAttrs(hps, lSegid, lAttribute, lValue);
</PRE>
This function is used to set the current value of the specified attribute.
This function is used to set the current value of the specified attribute.
<pre>
<pre>
#define INCL_GPISEGMENTS
#define INCL_GPISEGMENTS
#include &lt;OS2.H&gt;
#include <OS2.H>


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

Revision as of 02:21, 24 November 2025

This function sets a segment attribute.

Syntax

GpiSetSegmentAttrs(hps, lSegid, lAttribute, lValue)

Parameters

hps (HPS) - input
Presentation-space handle.
lSegid (LONG) - input
Segment identifier.
The identifier of the segment whose attribute is to be updated. It must be greater than zero.
lAttribute (LONG) - input
Segment attribute.
For details of the following attributes, see the GpiSetInitialSegmentAttrs function.
ATTR_DETECTABLE: Detectability
ATTR_VISIBLE: Visibility
ATTR_CHAINED: Chained
ATTR_DYNAMIC: Dynamic
ATTR_FASTCHAIN: Fast chaining
ATTR_PROP_DETECTABLE: Propagate detectability
ATTR_PROP_VISIBLE: Propagate visibility.
lValue (LONG) - input
Attribute value.
ATTR_ON: On/yes
ATTR_OFF: Off/no.

Return Value

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

Remarks

This function sets the value of one segment attribute for the specified segment. The segment can be any retained segment. If the identifier is that of the currently-open segment:

  • In retain mode, this is valid.
  • In draw-and-retain mode, the retained segment is updated, but there is no change to the immediate drawing.
  • In draw mode, it is invalid.

(For a description of drawing mode, see GpiSetDrawingMode). When a segment is modified from nonchained to chained, it is added to the end of the drawing chain.

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_SEG_NAME (0x20C8)
An invalid segment identifier was specified.
PMERR_INV_SEG_ATTR (0x20C5)
An invalid attribute parameter was specified with GpiSetSegmentAttrs, GpiQuerySegmentAttrs, GpiSetInitialSegmentAttrs, or GpiQueryInitialSegmentAttrs.
PMERR_INV_SEG_ATTR_VALUE (0x20C6)
An invalid attribute value parameter was specified with GpiSetSegmentAttrs or GpiSetInitialSegmentAttrs.
PMERR_SEG_NOT_FOUND (0x2100)
The specified segment identifier did not exist.
PMERR_INV_MICROPS_FUNCTION (0x20A1)
An attempt was made to issue a function that is invalid in a micro presentation space.

Example Code

This function is used to set the current value of the specified attribute.

#define INCL_GPISEGMENTS
#include <OS2.H>

HPS hps; /* Presentation-space */
/* handle. */
LONG lSegid; /* Segment identifier; must */
/* be greater than 0. */
/* */
/* The name of the */
/* segment for which */
/* attribute information is to */
/* be returned. */
LONG lAttribute; /* attribute to be queried */
LONG lValue;

lAttribute = ATTR_VISIBLE;

lValue = GpiSetSegmentAttrs(hps,
    lSegid,
    lAttribute,
    ATTR_ON);

Related Functions