IShortCutCollection.Add

Syntax

Add(Value: Integer);

Parameters

Value - combination of hot keys that must be added to the collection. Use the MakeShortcut property to create a combination of hot keys.

Description

The Add method adds a combination of hot keys to the collection.

Example

Executing the example requires a form, a button named Button1 on it and the MainMenu component that implements the main menu of the form. Several items have been created in the menu.

Sub Button1OnClick(Sender: Object; Args: IMouseEventArgs);

Var

SCCollect: IShortCutCollection;

Begin

MenuItem1.Text := "Copy";

MenuItem1.ShortCut := Self.MakeShortcut(KeyModifiers.Ctrl, Keys.C);

SCCollect := MenuItem1.AdditionalShortCuts;

SCCollect.Add(Self.MakeShortcut(KeyModifiers.Ctrl, Keys.Insert));

End Sub Button1OnClick;

After executing the example clicking the button changes name for the item of the MenuItem1 main menu and sets two combinations of hot keys. The first combination is set in the ShortCut main property, the second one is added to the collection of additional combinations of hot keys.

See also:

IShortCutCollection