GetEnumItemValue

PowerBuilder Native Interface

IPB_Session interface:

GetEnumItemValue method

Description

Obtains the value of an enumerated variable.

Syntax

GetEnumItemValue(LPCTSTR enumName, LPCTSTR enumItemName)

Return Values

Long.

Examples

This example gets the numeric value for the boolean! enumerated value, then uses it to return the string value:

pblong lType = session->GetEnumItemValue("object",
   boolean" ); // returns 138
LPCTSTR szEnum = session->GetEnumItemName( "object",
   lType ); // returns "boolean"

Usage

GetEnumItemValue and GetEnumItemName support enumerated types. They allow you to convert the name of an enumerated value, a string with an appended exclamation mark (!), to an integer value, and vice versa.

Note The ! character must be omitted

When you use these functions, the enumItemName should not use the appended exclamation mark (!) character.

To return an enumerated value from an extension to PowerScript, you must use the SetLong function to set the value of the enumerated variable into IPB_Value. Using SetInt or SetShort fails. However, you can use GetInt or GetShort as well as GetLong to obtain the enumerated variable's value, assuming the value is in the appropriate range. For example, if you attempt to use GetInt to obtain a value that is more than 32767, the returned value is truncated.

See Also

GetEnumItemName