HotKey (Delphi)
Description
To use this example, create a form with a main menu component and a HotKey component. At design time, use the Menu designer to add menu items, including a File menu with subitems that include a New menu item. Add the following code to the OnCreate method of the form and the OnClick event of the File menu item.
Code
procedure TForm1.File1Click(Sender: TObject);
begin
// Assign hotkey to the menu's File "New" item.
New1.ShortCut := HotKey1.HotKey;
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
// Default to "Ctrl + A"
HotKey1.Modifiers := [hkCtrl];
// Don't allow shift or alt
HotKey1.InvalidKeys := [hcShift, hcAlt];
end;
Uses
- Vcl.ComCtrls.TCustomHotKey.HotKey ( fr | de | ja )
- Vcl.ComCtrls.TCustomHotKey.InvalidKeys ( fr | de | ja )
- Vcl.ComCtrls.TCustomHotKey.Modifiers ( fr | de | ja )