MidikeyboardComponent usage question


#1

i have a midi editing grid component, which is strict contact with a a side midi keyboard component. i’ve removed the scrollbarButtons from the midi keyboard cause the user can’t scroll with that.
but the user can mouse wheel over the grid, to scroll up and down the available rows (midi notes), and i need to keep in sync the grid and the midi keys.
from the main component, if i catch up a mouse wheel, i update the grid row offset start / end notes, and i set the “setLowestVisibleKey” of the midi keyboard to the same start offset value (i borrowed the code from the UpDownScrollButton in MidikeyboardComponent to scroll by an octave).
the problem is that the midi keyboard doesn’t scroll like the grid.

how i’m supposed to scroll programmatically a midi keyboard without the scroll buttons (with scroll buttons calling “setLowestVisibleKey” works) ?


#2

Hmm, you’d need to tweak it a bit around line 575 - maybe like this?

[code] int kx2, kw2;
getKeyPos (rangeEnd, kx2, kw2);

    kx2 += kw2;

    if (firstKey != rangeStart)
    {
        int kx1, kw1;
        getKeyPos (rangeStart, kx1, kw1);

        if (kx2 - kx1 <= w)
        {
            firstKey = rangeStart;
            sendChangeMessage (this);
            repaint();
        }
    }

    const bool showScrollButtons = canScroll && (firstKey > rangeStart || kx2 > w + xOffset * 2);

[/code]


#3

mmh it doesn’t scroll either…


#4