Utilizing KeyPressTarget Demo Code?

I am able to get visual inside the plugin.
However, I am unable to get the class/button to respond to key events.
Any Ideas where to put, and what functions to use when calling the KeyPressTarget class?

Are you using the KeyMappingsDemo example? If not, this is a good place to look to see how to handle key press commands in JUCE

The class I am referring to resides in the KeyMapping demos.

I just can’t seem to get the “copied” class to respond to key press or receive keyboard focus within the plugineditor.

Any way you know where to call Keypress functions or to set the keyboard focus so the block will respond by moving to arrow keys?

Have you tried enabling the “Plugin Editor Requires Keyboard Focus” option in the plugin project settings in the Projucer?

Thanks, it seems my pursuit was doomed before the class calls.

I enabled VST keyboard focus, However I am still at a loss to get the basic functionality of class demo to work. As I fun exercise I am trying to make a Pong game.

//=======================================================
In my plugineditor.h

KeyPressTarget Player;

//=======================================================
PongAudioProcessorEditor::PongAudioProcessorEditor (PongAudioProcessor& p)
: AudioProcessorEditor (&p), processor §
{
// Make sure that before the constructor has finished, you’ve set the
// editor’s size to whatever you need it to be.
setSize (900, 500);
addAndMakeVisible(Player);
Player.setSize(900, 500);
Player.getWantsKeyboardFocus();
Player.setWantsKeyboardFocus(true);
Player.setMouseClickGrabsKeyboardFocus(true);

}

// =======================================================

Any major gaps I am missing? Thanks again, for the help thus far…

Hey guys. Sorry to “hijack” this post, but it was the closest example I could find to what I was looking for.

I currently have ApplicationCommandTarget working in standalone JUCE applications and am wondering if I can simply use the same code for key commands from within a VST plugin, so long as I enable the “Plugin Editor Requires Keyboard Focus” option in Projucer.

A quick confirm or deny response would be much appreciated, as it’s a bit of work to port all of my code over to the plugin project if it’s ultimately doomed to fail.

Thanks in advance!

I can’t think of any reason why this wouldn’t work in principle, the plug-in is at the mercy of the host as to what key commands are passed through though.

1 Like

Good to know. Thanks, Ed!