Hi,
I've Component who react on leftKey and rightKey code in their keyPressed method.
I add them in juce::ListBox, everything work fine until horizontal Scrollbar appear.
In this case, Viewport::keyPressed interprets lefKey rightKey code instead of my Component.
To fix this issue, I had to modify the ListBox::ListViewport::keyPressed method like this:
bool keyPressed (const KeyPress& key) { if (key.isKeyCode (KeyPress::upKey) || key.isKeyCode (KeyPress::downKey) || key.isKeyCode (KeyPress::pageUpKey) || key.isKeyCode (KeyPress::pageDownKey) || key.isKeyCode (KeyPress::homeKey) || key.isKeyCode (KeyPress::endKey) || key.isKeyCode (KeyPress::leftKey) // this line was added || key.isKeyCode (KeyPress::rightKey) // this line was added ) { const int allowableMods = owner.multipleSelection ? ModifierKeys::shiftModifier : 0; if ((key.getModifiers().getRawFlags() & ~allowableMods) == 0) { // we want to avoid these keypresses going to the viewport, and instead allow // them to pass up to our listbox.. return false; } } return Viewport::keyPressed (key); }
I hope this can help
Thanks in advance for your concern about this issue.