Utilizing KeyPressTarget Demo Code?


#1

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?


#2

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


#3

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?


#4

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


#5

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…