RAD Studio VCL Reference
TShortCutList.Add Method

Adds a new shortcut to the list.

function Add(const S: String): Integer; override;
virtual __fastcall int Add(const AnsiString S);

Call Add to add a shortcut to the list. If the list is sorted, the shortcut is added to the appropriate position in the sort order. If the list is not sorted, the shortcut is added to the end of the list. Add returns the position of the shortcut in the list, where the first item in the list has a value of 0. 

S is the string representation of the shortcut to add. You can obtain this from a shortcut using the global ShortCutToText function. TShortCutList saves the string S as a new string in the list and the corresponding shortcut as an Object associated with that string.

Note: For sorted lists, Add raises an EListError exception if the string S already appears in the list and Duplicates is set to dupError. If Duplicates is set to dupIgnore, trying to add a duplicate string to a sorted list does nothing.


Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
What do you think about this topic? Send feedback!