void __fastcall TCalculadora::FormKeyDown(TObject *Sender, WORD &Key, TShiftState Shift) { WORD keySubtrair = 109; if (Key == keySubtrair) ButtonSubtrair->Click(); WORD keySomar = 107; if (Key == keySomar) ButtonSomar->Click(); WORD keyMultiplicar = 106; if (Key == keyMultiplicar) ButtonMultiplicar->Click(); WORD keyDividir = 111; if (Key == keyDividir) ButtonDividir->Click(); WORD keyResultado = 13; if (Key == keyResultado) ButtonResultado->Click(); WORD keyLimparTudo = 27; if (Key == keyLimparTudo) ButtonLimparTudo->Click(); if (Key == 110 && virgula == false) { ButtonedEditValor->Text = ButtonedEditValor->Text.ToDouble(); Foco (); } else { virgula = true; } switch (Key) { case 96: if (ButtonedEditValor->Text == 0) ButtonedEditValor->Text = "";break; case 97: if (ButtonedEditValor->Text == 0) ButtonedEditValor->Text = "";break; case 98: if (ButtonedEditValor->Text == 0) ButtonedEditValor->Text = "";break; case 99: if (ButtonedEditValor->Text == 0) ButtonedEditValor->Text = "";break; case 100: if (ButtonedEditValor->Text == 0) ButtonedEditValor->Text = "";break; case 101: if (ButtonedEditValor->Text == 0) ButtonedEditValor->Text = "";break; case 102: if (ButtonedEditValor->Text == 0) ButtonedEditValor->Text = "";break; case 103: if (ButtonedEditValor->Text == 0) ButtonedEditValor->Text = "";break; case 104: if (ButtonedEditValor->Text == 0) ButtonedEditValor->Text = "";break; case 105: if (ButtonedEditValor->Text == 0) ButtonedEditValor->Text = "";break; } if(Shift.ToInt()==1 ) { ShowMessage(Key); } // if(Key > 48 && Key < 57 || Key > 96 && Key < 111) //|| Key 190 188 ) // ShowMessage("NUMERO"); }
// --------------------------------------------------------------------------- // void __fastcall TForm1::FormKeyDown(TObject *Sender, WORD &Key, TShiftState Shift) { String code; code = code.sprintf(L"%1x%02x", Shift.ToInt(), Key); ExecAction(KeyConf->ReadString(L"key", code, NULL).LowerCase()); // Key = NULL; }