Command + Period -> is not being recognized in KeyDown


#1

Hey there,

I’d like to know if I am doing something wrong here, or if this is a bug.

I’m trying to recognize command + period in my KeyDown method:

void TestApp::keyDown( KeyEvent event ){
    cout << "period_01: " << (event.getCode() == KeyEvent::KEY_PERIOD) << endl;
    cout << "period_02: " << (event.getChar() == KeyEvent::KEY_PERIOD) << endl;
    cout << "period_03: " << (event.getChar() == '.') << endl;
    
    cout << "cmd: " << (event.isMetaDown()) << endl;
    
    cout << getElapsedSeconds() << endl << endl;
}

When i hold the cmd-key the period-key is not recognized as a new keydown event. Every other key is, though…


#2

Are you on a mac? When I press cmd+period I hear a bell sound, which means it is handled by the operating system. Cmd+period is some kind of cancel button for closing dialogs on a mac as a quick google search shows. It is handled as a cancel operation before it reaches the keyDown method.