Try OpenEdge Now
skip to main content
GUI for .NET Programming
Using .NET data types in ABL : Accessing and using .NET enumeration types : Using the Progress.Util.EnumHelper class
 

Using the Progress.Util.EnumHelper class

The Progress.Util.EnumHelper class provides public static methods that accept .NET enumeration members as INPUT parameters in the form of System.Enum objects. These methods then perform common operations on the INPUT members and return either a LOGICAL value or a new instance of System.Enum, depending on the operation. Together, these methods support the basic operations that you can perform on a primitive type in .NET. Note that the available operations on a given .NET enumeration type depend both on its underlying primitive data type and whether it is defined with the System.FlagsAttribute class to allow bit-wise operations.
The following table lists these methods showing a brief signature and description of the operation that each method performs. For more information on this class and its methods, see the Progress.Util.EnumHelper class reference entry and its respective method entries in OpenEdge Development: ABL Reference.
Method
Description
Add( enum1, enum2 )
Adds (+) the underlying values of enum1 and enum2 and returns the sum as a new instance
Subtract( enum1, enum2 )
Subtracts (-) the underlying value of enum1 from enum2 and returns the difference as a new instance
AreEqual( enum1, enum2 )
Returns TRUE if the underlying values of enum1 and enum2 are equal (=); otherwise, returns FALSE
AreNotEqual( enum1, enum2 )
Returns TRUE if the underlying values of enum1 and enum2 are not equal (<>); otherwise, returns FALSE
IsGreater( enum1, enum2 )
Returns TRUE if the underlying value of enum1 is greater than (>) enum2; otherwise, returns FALSE
IsLess( enum1, enum2 )
Returns TRUE if the underlying value of enum1 is less than (<) enum2; otherwise, returns FALSE
IsGreaterOrEqual( enum1, enum2 )
Returns TRUE if the underlying value of enum1 is greater than or equal to (>=) enum2; otherwise, returns FALSE
IsLessOrEqual( enum1, enum2 )
Returns TRUE if the underlying value of enum1 is less than or equal to (<=) enum2; otherwise, returns FALSE
And( enum1, enum2 )
Applies a bit-wise AND operation between the underlying values of enum1 and enum2, and returns the result as a new instance1
Or( enum1, enum2 )
Applies a bit-wise OR operation between the underlying values of enum1 and enum2, and returns the result as a new instance2
Xor( enum1, enum2 )
Applies a bit-wise exclusive OR operation between the underlying values of enum1 and enum2, and returns the result as a new instance3
Complement( enum )
Applies a bit-wise complement operation to the underlying value of enum, and returns the result as a new instance4

1 The enumeration type specified by the System.Enum arguments to this method must be defined using the System.FlagsAttribute class. For more information, see the .NET documentation for the specified enumeration type.

2 The enumeration type specified by the System.Enum arguments to this method must be defined using the System.FlagsAttribute class. For more information, see the .NET documentation for the specified enumeration type.

3 The enumeration type specified by the System.Enum arguments to this method must be defined using the System.FlagsAttribute class. For more information, see the .NET documentation for the specified enumeration type.

4 The enumeration type specified by the System.Enum arguments to this method must be defined using the System.FlagsAttribute class. For more information, see the .NET documentation for the specified enumeration type.

The following example performs a bit-wise OR of two AnchorStyles enumeration members, casts and assigns the result to the Anchor property, and displays that result:
USING System.Windows.Forms.* FROM ASSEMBLY.
USING Progress.Util.*        FROM ASSEMBLY.

DEFINE VARIABLE rButton AS Button      NO-UNDO.
DEFINE VARIABLE rEnum   AS System.Enum NO-UNDO.

ASSIGN
  rButton        = NEW Button( )
  rEnum          = EnumHelper:Or(AnchorStyles:Bottom, AnchorStyles:Right)
  rButton:Anchor = CAST(rEnum, AnchorStyles).
MESSAGE rButton:Anchor VIEW-AS ALERT-BOX.