ShortCutToKey (C++)
Description
The following code redefines the ShortCut of CloseCommand if the original shortcut used the [ssCtrl] shift state.
Code
void __fastcall TForm1::Button1Click(TObject *Sender)
{
Word TheKey;
TShiftState TheShiftState;
ShortCutToKey(CloseCommand->ShortCut, TheKey, TheShiftState);
if (TheShiftState.Contains(ssCtrl))
CloseCommand->ShortCut = ShortCut(Word('C'), TShiftState() << ssShift);}
void __fastcall TForm1::CloseCommandClick(TObject *Sender)
{
MessageDlg(
"The Close command has been selected.",
mtInformation,
TMsgDlgButtons() << mbOK,
0);
}
__fastcall TForm1::TForm1(TComponent* Owner)
: TForm(Owner)
{
CloseCommand->ShortCut =
ShortCut(Word('C'), TShiftState() << ssCtrl);
}
Uses
- Vcl.Menus.ShortCutToKey ( fr | de | ja )