//code of keydown event of operator key(+,-.*,/)
void App2::MainPage::ArithKey_Down(Platform::Object ^ sender, Windows::UI::Xaml::Input::KeyRoutedEventArgs ^ e)
{
//Get the string from the display, convert it to a number, and then store it as the left operand
leftOperand = ConvertTextToInt(txtOutput->Text);
int Op = (int)e->Key;
if (Op == 107)
currentOp = ArithOp::PLUS;
elseif (Op == 109)
currentOp = ArithOp::MINUS;
elseif (Op == 106)
currentOp = ArithOp::TIMES;
elseif (Op == 111)
currentOp = ArithOp::DIVIDE;
//Clear the display
txtOutput->Text = "";
clearOnNextKey = false;
}
I tested these using "123+456=579" scenario.
result:
1. inputting "123" works well.
2. "+" key downs't work.
I can't find out what's wrong with the code.
If anyone pick error for me, I'd very appreciate of it.