Previous Next

Complement( ) method

(Windows only; GUI for .NET only)
Performs a bitwise complement (NOT) operation on the underlying value of the specified enumeration type and returns a new instance. You typically use this method to unset (turn off) a flag.
Return type:
Access:
Applies to:
 
Syntax 
EnumHelper:Complement ( INPUT enum AS CLASS System.Enum )
enum
Static reference to an enumeration value, or a reference to an enumeration type instance.
Specify a static reference to an enumeration value using the following syntax:
 
Syntax 
enum-type:enum-member 
Where enum-type is the type name of the enumeration and enum-member is a member name of the enumeration. For example:
 
System.Windows.Forms.AnchorStyles:Bottom
The following example uses this method to invert flags:
 
USING System.Windows.Forms.* FROM ASSEMBLY.
USING Progress.Util.* FROM ASSEMBLY.
 
DEFINE VARIABLE rMyStyle AS System.Enum NO-UNDO.
 
/* Adds Bottom and Right to the list */ 
rMyStyle = EnumHelper:Or( AnchorStyles:Bottom, AnchorStyles:Right ). 
DISPLAY STRING( rMyStyle ) FORMAT "x(20)" SKIP. 
/* Displays "Bottom, Right" */
 
/* Sets all flags that are not set and clears all that are */
rMyStyle = EnumHelper:Complement( rMyStyle ). 
DISPLAY STRING( rMyStyle ) FORMAT "x(20)" SKIP. 
/* Displays "-11", which includes Top and Left but not Bottom or Right */
 
rMyStyle = EnumHelper:Complement( rMyStyle ). 
DISPLAY STRING( rMyStyle ) FORMAT "x(20)". 
/* Displays "Bottom, Right" */
If you want to use the returned System.Enum instance as a different enumeration type, you must cast the instance to that specific type using the CAST function.
For information on the System.Enum class and .NET enumeration types, refer to the .NET Framework class library.
See also:

Previous Next
© 2013 Progress Software Corporation and/or its subsidiaries or affiliates.