Adds an element to a Delphi set or adds an event handler in .NET applications.
procedure Include(var S: set of T; I: T);
Include(set of T S, T I);
When the first argument of Include is a set type variable, Include adds an element to the set. The expression Include(S,I) corresponds to S := S + [I], where S is a set type variable, and I is an expression of a type compatible with the base type of S. The Include procedure generates more efficient code than using the + operator.
On the .NET platform, Include is overloaded. When the first argument of Include is a multicast event, and the second argument is an event handler, Include adds the event handler as a listener to the event.
Delphi Examples:
{ This example demonstrates the use of Include and Exclude routines. The example assumes a form with three checkboxes and a button. Also a field called FMsgButtons of type TMsgDlgButtons is declared in the form. } procedure TOptionsForm.btShowMessageClick(Sender: TObject); begin //Creates a Message Dialog with the Selected Buttons MessageDlg('Hello World!', mtInformation, FMsgButtons, 0); end; procedure TOptionsForm.CheckBoxClick(Sender: TObject); begin { Check wether an option is selected and add an element into a set, or exclude it from the set} if cbYes.Checked then Include(FMsgButtons, mbYes) else Exclude(FMsgButtons, mbYes); if cbNo.Checked then Include(FMsgButtons, mbNo) else Exclude(FMsgButtons, mbNo); if cbCancel.Checked then Include(FMsgButtons, mbCancel) else Exclude(FMsgButtons, mbCancel); end;
Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
|
What do you think about this topic? Send feedback!
|