Can i paint over MIDIKeyboardComponent?

Is it possible to paint over the MIDIKeyboardComponent?

Even when I call repaint() after making it visible my graphics always appear to be behind it.

Cheers

Have you tried experimenting with MIDIKeyboardComponent::toBehind() ?
Another option would be to derive from MIDIKeyboardComponent and customize it’s paint function.

If you do derive from MidiKeyboardComponent you’ll have to change it’s private members to protected – and depending on what you want to change you may have to make some small changes to the MidiKeyboardComponent code – so you may want to just copy the MidiKeyboardComponent and modify that as a new class.

One of the changes I had to make was change:

void MidiKeyboardComponent::repaintNote (int noteNum)
{
    if (noteNum >= rangeStart && noteNum <= rangeEnd)
        repaint (getRectangleForKey (noteNum));
}

To:

void MidiKeyboardComponent::repaintNote (int noteNum)
{
    if (noteNum >= rangeStart && noteNum <= rangeEnd)
        repaint();
}

Here’s a video of our product with the modified MidiKeyboardComponent

At about 9:14

Rail

1 Like

in your parent component, you can override Component::paintOverChildren()