Reputation: 8043
Starting from a set type variable like TAnchors
:
TAnchorKind = (akLeft, akTop, akRight, akBottom);
TAnchors = set of TAnchorKind;
I'm trying to get the complementary values.
var
Tmp : TAnchors;
begin
Tmp := [akLeft];
...
end;
I'm expecting to get all values of TAnchors
which are not in the Tmp
variable.
For example, starting from [akLeft]
, I'm expecting to get [akTop, akRight, akBottom]
.
I've tried using the not
operator but it seems it doesn't work for Sets types
.
Upvotes: 1
Views: 159
Reputation: 612914
The set operators are listed in the documentation. The not
operator is not listed here which is why it cannot be used on a set. However, you are looking for the difference operator, -
. Take the difference between the set including all members, and your set:
[Low(TAnchorKind)..High(TAnchorKind)] - Anchors
Upvotes: 4