Hey all,
I noticed that there are many threads regarding keyboard input problems especially under Windows when the juce framework is used in plugins. For example the Label or TextEditor do receive keystrokes or not depending on the host and the OS.
For this reason I’d like to set up a listing, where everybody can post which solution worked for him/her for a combination of juce Component, plugin-host and OS.
This could help to share some knowledge, so that the wheel has not be reinvented over and over again.
Let me start…
Component:Label
OS:Windows
tested Hosts: Samplitude, Cubase/Nuendo, Live, Minihost, VstHost
notes: Sonar under Windows only works with the Standard juce::Label and not with the suggested solution for the other hosts!
EDIT 2010.01.02:
OS:OSX 10.5 (just remove the “#if JUCE_WIN32”)
tested Hosts: Logic 8
Implementation: subclass from juce::Label and implement the following functions of juce::Label in your subclass.
void YourLabel::editorShown (TextEditor* editorComponent)
{
#if JUCE_WIN32
originalParent = getParentComponent();
originalX = getX();
originalY = getY();
addToDesktop(ComponentPeer::windowIsTemporary);
#endif
}
void YourLabel::editorAboutToBeHidden (TextEditor* editorComponent)
{
#if JUCE_WIN32
originalParent->addChildComponent(this);
setBounds(originalX, originalY, getWidth(), getHeight());
#endif
}
Component:TextEditor
OS:Windows
tested Hosts: Samplitude, Cubase/Nuendo, Live, Minihost, VstHost
notes: Sonar under Windows only works with the Standard juce::TextEditor and not with the suggested solution for the other hosts!
EDIT 2010.01.02:
OS:OSX 10.5 (just remove the “#if JUCE_WIN32”)
tested Hosts: Logic 8
Implementation: subclass from TextEditor and implement the following functions:
void YourTextEditor::focusGained (FocusChangeType cause)
{
#if JUCE_WIN32
if(!isOnDesktop() && !isReadOnly())
{
originalParent = getParentComponent();
originalX = getX();
originalY = getY();
addToDesktop(ComponentPeer::windowIsTemporary);
setAlwaysOnTop(true);
TextEditor::focusGained(cause);
grabKeyboardFocus();
}
#endif
TextEditor::focusGained(cause);
}
void YourTextEditor::focusLost (FocusChangeType cause)
{
#if JUCE_WIN32
if(isOnDesktop())
{
originalParent->addChildComponent(this);
setBounds(originalX, originalY, getWidth(), getHeight());
setAlwaysOnTop(false);
TextEditor::focusLost(cause);
}
#endif
TextEditor::focusLost(cause);
}
If you have improvements or problems with the posted solutions, please let me know.
Everybody is invited to post other solutions for Components, hosts and OSs.
@yfede:
In this post http://www.rawmaterialsoftware.com/juceforum/viewtopic.php?t=4330 you said, you’re checking at runtime what’s the parent host of your plugin. How do you do that? I need something like this to fix the Sonar problem, so that I don’t add the Components to the Desktop if Sonar is the host.
Edit: As suggesetd, I’ve tried to collect the posts regarding this issue - this is an uncomplete collection. I will add new ones when I remeber where I read them.
http://www.rawmaterialsoftware.com/juceforum/viewtopic.php?t=4330&highlight=keystroke
http://www.rawmaterialsoftware.com/juceforum/viewtopic.php?t=1662&highlight=keystroke
http://www.rawmaterialsoftware.com/juceforum/viewtopic.php?t=4330
http://www.rawmaterialsoftware.com/juceforum/viewtopic.php?t=312&highlight=keystroke
http://www.rawmaterialsoftware.com/juceforum/viewtopic.php?t=4357&highlight=keyboard
http://www.rawmaterialsoftware.com/juceforum/viewtopic.php?t=3999&highlight=keyboard
http://www.rawmaterialsoftware.com/juceforum/viewtopic.php?t=3817&highlight=keyboard
http://www.rawmaterialsoftware.com/juceforum/viewtopic.php?t=1770&highlight=keyboard