Currently if VST plugin has a TextEdit on it, it consumes keys it shouldn't. I think fix is the following, am I right?
juce_win32_Windowing.cpp:
case VK_LEFT:
case VK_RIGHT:
case VK_UP:
case VK_DOWN:
case VK_PRIOR:
case VK_NEXT:
case VK_HOME:
case VK_END:
case VK_DELETE:
case VK_INSERT:
case VK_F1:
case VK_F2:
case VK_F3:
case VK_F4:
case VK_F5:
case VK_F6:
case VK_F7:
case VK_F8:
case VK_F9:
case VK_F10:
case VK_F11:
case VK_F12:
case VK_F13:
case VK_F14:
case VK_F15:
case VK_F16:
used = handleKeyUpOrDown (true);
used = handleKeyPress (extendedKeyModifier | (int) key, 0) || used;
break;
Should be:
case VK_UP:
case VK_DOWN:
used = handleKeyUpOrDown (true); //! fix for keys
case VK_LEFT:
case VK_RIGHT:
case VK_PRIOR:
case VK_NEXT:
case VK_HOME:
case VK_END:
case VK_DELETE:
case VK_INSERT:
case VK_F1:
case VK_F2:
case VK_F3:
case VK_F4:
case VK_F5:
case VK_F6:
case VK_F7:
case VK_F8:
case VK_F9:
case VK_F10:
case VK_F11:
case VK_F12:
case VK_F13:
case VK_F14:
case VK_F15:
case VK_F16:
//used = handleKeyUpOrDown (true); //! fix for keys
used = handleKeyPress (extendedKeyModifier | (int) key, 0) || used;
break;
It works for me, is it a proper way to handle that? If somebody checks it in please let me know.
No, definitely not the right approach.. But you'd want a TextEditor to consume these keys (?)
If you have some kind of custom TextEditor and you want it to ignore the keys, then you'd subclass TextEditor and override its keyPressed method to ignore them and return false.
No, opposite, I do not want editor to consume keys, but currently it does. If I return false in keyPressed method of subclassed TextEditor - it's return value is ignored, and my Cubase doesn't get it's F3 key (for example).
Why do we need handleKeyUpOrDown call for F3 and other keys? This call sets "used" variable to true and we have key swallowed..
handleKeyUpOrDown is method of ComponentPeer, not one of Component or TextEditor, so overriding it is either wrong, or I'm not getting you right. I'll just post you code that doesn't work (F3 and other keystrokes are trapped):
We try to call people out when they post bad code on here - not just to help the poster improve, but because we have a lot of beginners reading the forum, and they might not otherwise be aware when something is a bad example to follow!