ToggleFlag( ) method
- Last Updated: January 18, 2024
- 1 minute read
- OpenEdge
- Version 12.8
- Documentation
Return type: Flag enum type
Access: PUBLIC
Applies to: Progress.Reflect.Flags enumeration, Progress.Reflect.ParameterMode enumeration, any user-defined flag enum type
Syntax
|
- flag
- A reference to a flag enum instance. The enum type (flag-enum-type) of this instance must match the type of the instance the method is invoked on.
The following example results in vReflectFlag, an instance of
Progress.Reflect.Flags, with the Public flag set and the
Protected flag unset:
|
You can use the bitwise XOR operator to achieve the same result. For example, replacing the
last line with vReflectFlag = vReflectFlag XOR Flags:Protected also toggles
the status of the Protected flag.
Notes
- This method is available for all built-in flag enums, and the compiler automatically generates
it for all user-defined flag enums. For example, this code excerpt uses a user-defined
Permissionsflag enum, initializesvPermwith theReadflag set, and then usesToggleFlag( )to set theCreateflag, resulting in an enum instance with both theReadandCreateflags set:ENUM Permission FLAGS: DEFINE ENUM None = 0 Read Write ReadWrite = Read,Write Create Delete. END ENUM.DEFINE VARIABLE vPerm AS Permission. vPerm = Permission:Read. /* This toggles the Create flag without affecting the status of any of the other flags in vPerm. */ vPerm = vPerm:ToggleFlag(Permission:Create).
See also
SetFlag( ) method, UnsetFlag( ) method, XOR operator (bitwise)