Exclude Procedure
The Exclude
procedure removes the element
Value
from the set variable
ASet
. The type of Value
must be
the base type of ASet
. Exclude
is not a real procedure.
Note that you cannot use a property for the set reference because a
property value cannot be used as a var
parameter.
Instead, use the -
operator to remove the member
from the set, as shown below:
Font.Style := Font.Style - [fsBold];
// The TFontStyleProperty editor toggles the bold font style when
// the user double-clicks the TFont.Style property in the
// object inspector.
type
TFontStyleProperty = class(TSetProperty)
public
procedure Edit; override;
end;
...
procedure TFontStyleProperty.Edit;
var
Style: TFontStyles;
begin
Style := TFontStyles(Byte(GetOrdValue));// Get the current font style.
if fsBold in Style then
Exclude(Style, fsBold)
else
Include(Style, fsBold);
SetOrdValue(Byte(Style)); // Set the component's font style.
end;