Way to differentiate Enter and Return Keys


#1

Hi,

Is there a way to differentiate the Enter key (the one in the keypad) and return Key (the other one)?

Thanks,


#2

For my machine, the character is different.

[code] else if(key.isKeyCode (KeyPress::returnKey))
{
cout << "keycode " << key.getKeyCode() << " char " << key.getTextCharacter() << endl;

}[/code]

Not sure if this can be used cross-platform.


#3

Jules ?


#4

Checking the text character might actually work ok, but it’s not something that’s guaranteed to be cross-platform.


#5

Jules,

Can you add another keyCode to distinguish these. I see several posts wanting to use enter and return as separate key strokes?


#6

Hmm. It's a sensible request, but the trouble is that if I move the enter key events to a new value, then existing code which expects to detect both return + enter will stop working with the enter key.


#7

Again I'll ask this and I am sure many others would use it. For the case where others are testing for just return, it is simple to add the test for enter.  Yes they migh not catch it immediately, but eventually they will and most use return anyway.

Everytime I update juce I spend at least a day redoing my code that doesn't compile or work, so the argument against implementing it is not a strong one.


#8

No, my argument against doing this is a very strong one..

Changes that trigger compile errors may be annoying, but they're safe because they let you know when something has changed and you can update your code appropriately. But changing something that causes the user's program behaviour to silently change without them knowing is really NOT ok, and that's what would happen if I changed this.


#9

Ok, how about being able to set a juce flag that allows both.


#10

Oh I don't know. How about if it was made to reliably return a different text character for the different keys?