IShortCutCollection.Add

Syntax

Add(Value: Integer);

Parameters

Value. The hotkey combination, which must be added to the collection.

Description

The Add method adds a combination of hotkeys to the collection.

Comments

To create a hotkey combination specified in the Value parameter, use the MakeShortcut property.

Example

Executing the example requires a form, the Button1 button on the form, and the MainMenu component that implements the main form menu. 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 keys combinations. 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