I have a Juce VST plugin that is running on Mac 10.6 and Windows 7 under Cubase. There are several sliders with editable valueBox labels in the UI. In Cubase 5 on Mac clicking in the valueBox gains focus and key presses have the desired effect when typing in numbers. In Cubase 5 on Windows, however, while the label appears to gain focus on a single click, any key presses that have a pre-defined special Cubase function – including most number keys – are sent directly to Cubase and not to the label. These same key presses are also defined as Cubase functions on Mac, however somehow on Mac the key routing to the label works and on Windows it does not. JucePlugin_EditorRequiresKeyboardFocus is set to 1 in both cases. On stepping through the code all the normal functions stemming from grabKeyboardFocus() are correctly executed when the label is clicked in both Mac and Windows. So what is going on? Is there a way to REALLY grab focus on Windows. What makes the behavior different on Windows then Mac? In a previous version of the plugin based directly on VSTGUI I did not have this problem. So there must be a way to solve this nagging focus problem. Any ideas would be helpful.
Did you try doing setWantsKeyboardFocus (true) on your editor and any components that might want it…?
http://www.rawmaterialsoftware.com/viewtopic.php?f=8&t=6188
I’ve got exactly the same problem. It does work in Reaper but not with Cubase.
And adding setWantsKeyboardFocus () or GrabKeyboardFocus () in my editor or my text boxes doen’t help.
Any idea what’s going on?
Have a look at this post. Putting the TextEditor on the desktop while editing helps but should be done host-dependet. Though I must admit I never tried what would happen on hosts where I use the normal TextEditor.
Chris
I also have tried setWantsKeyboardFocus () or GrabKeyboardFocus () but have had no success. I believe that Chris’ solution may work but unfortunately that means redefining every class that uses a text editor or worse, every class that uses a class that uses a text editor … – e.g. slider which uses label which uses a text editor. I think this needs to be solved at the root level. My experience is that VSTGUI editor does not have this problem – probably since VSTGUI is done by the same folks that do Cubase. Anyway, maybe looking at the way VSTGUI grabs focus may prove inspirational. I had this problem in the past with a 3rd party copy protection library. Even though my VSTGUI based GUI worked correctly, when my VSTGUI plugin popped up the authorization panel whose code was provided in a 3rd party library, it was not able to grap focus from Cubase. So grabbing focus seems to be a tricky problem but VSTGUI seems to have gotten it right. The VSTGUI grab focus seems to work with all the host sequencers I’ve tested – Cubase, Logic, Sonar, DP, Live, Protools, Sibelius, Finale, Max/MSP, … and with AU, VST, RTAS, and DXi plugin formats.
I also have tried setWantsKeyboardFocus () or GrabKeyboardFocus () but have had no success. I believe that Chris’ solution may work but unfortunately that means redefining every class that uses a text editor or worse, every class that uses a class that uses a text editor … – e.g. slider which uses label which uses a text editor. I think this needs to be solved at the root level. My experience is that VSTGUI editor does not have this problem – probably since VSTGUI is done by the same folks that do Cubase. Anyway, maybe looking at the way VSTGUI grabs focus may prove inspirational. I had this problem in the past with a 3rd party copy protection library. Even though my VSTGUI based GUI worked correctly, when my VSTGUI plugin popped up the authorization panel whose code was provided in a 3rd party library, it was not able to grap focus from Cubase. So grabbing focus seems to be a tricky problem but VSTGUI seems to have gotten it right. The VSTGUI grab focus seems to work with all the host sequencers I’ve tested – Cubase, Logic, Sonar, DP, Live, Protools, Sibelius, Finale, Max/MSP, … and with AU, VST, RTAS, and DXi plugin formats.
Does anyone have any new ideas on this problem. It’s kind of a showstopper since many people use Cubase and we need to be able to have people select text box – e.g. slider labels – and type into them.
Thanks
Instead of hacking the slider’s textbox you could use a hacked texteditor in addition with a slider without a textbox. Of course you need to sync slider and textbox for this, but you could stuff that in a class.
Chris
[quote=“ckk”]Of course you need to sync slider and textbox for this, but you could stuff that in a class.
[/quote]
I wonder if this might be useful in general. This would allow for parameter range warping to occur within the plugin, instead of the editor, which would allow the automation parameters in the host to have the same warping as within the GUI editor.
Sean Costello
What I’d really like is to figure out why VSTGUI is able to get keyboard focus in Cubase for Windows and Juce is not. I see that Juce uses the MS Windows function SetFocus() from within its set focus Windows callback. Unfortunately I know next to nothing about these gory Windows details being mainly and signal processing guy. Does anyone have a clue or can anyone trace the equivalent behavior in the VSTGUI code and contrast and compare to determine what is going on?