//---------------------------------------------------------------------------

#include <vcl.h>
#pragma hdrstop

#include "ShortCutToKey.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm1 *Form1;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
	: TForm(Owner)
{
}
//---------------------------------------------------------------------------
// BeginExample: ShortCutToKey
// Routine: Menus.ShortCutToKey

// BeginCode
/*
The following code redefines the ShortCut of CloseCommand if
the original short cut used the [ssCtrl] shift state.
*/
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);
}

void __fastcall TForm1::FormCreate(TObject *Sender)
{
  CloseCommand->ShortCut =
	ShortCut(Word('C'), TShiftState() << ssCtrl);
}
// EndCode
// EndExample: ShortCutToKey
//---------------------------------------------------------------------------
