RAD Studio VCL Reference
|
Allows you to specify that one or more modifier keys should be considered invalid.
property InvalidKeys: THKInvalidKeys;
__property THKInvalidKeys InvalidKeys;
Use InvalidKeys to select which modifier keys are not allowed. If this property is set, a default modifier should also be specified in the Modifiers property. When the invalid key is selected, the default modifier is displayed in its place.
THKInvalidKey is the type of the InvalidKeys property. These are the possible values:
Value |
Meaning |
hcNone |
Unmodified keys are invalid. |
hcShift |
The Shift key is invalid as a modifier. |
hcCtrl |
The Ctrl key is invalid as a modifier. |
hcAlt |
The Alt key is invalid as a modifier. |
hcShiftCtrl |
The Shift+Ctrl key combination is invalid as a modifier. |
hcShiftAlt |
The Shift+Alt key combinations invalid as a modifier. |
hcCtrlAlt |
The Ctrl+Alt key combination is invalid as a modifier. |
hcShiftCtrlAlt |
The Shift+Ctrl+Alt key combination is invalid as a modifier. |
The default values are hcNone and hcShift.
C++ Examples:
/* 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 includes a "New" menu item. Add the following code to the OnCreate method of the form and the OnClick event of the File menu item. */ void __fastcall TForm1::File1Click(TObject *Sender) { // Assign HotKey to the menu's File "New" item. New1->ShortCut = HotKey1->HotKey; } void __fastcall TForm1::FormCreate(TObject *Sender) { // Default to "Ctrl + A" HotKey1->Modifiers.Clear(); HotKey1->Modifiers << hkCtrl; // Don't allow shift or alt HotKey1->InvalidKeys.Clear(); (HotKey1->InvalidKeys << hcShift) << hcAlt; // HotKey1->Visible = false; }
Delphi Examples:
{ 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 includes a "New" menu item. Add the following code to the OnCreate method of the form and the OnClick event of the File menu item. } 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;
Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
|
What do you think about this topic? Send feedback!
|