I need to disable auto-scrolling for ListBox
when using selectRangeOfRows
declared in juce_ListBox.h.
void ListBox::selectRangeOfRows (int firstRow, int lastRow)
{
if (multipleSelection && (firstRow != lastRow))
{
const int numRows = totalItems - 1;
firstRow = jlimit (0, jmax (0, numRows), firstRow);
lastRow = jlimit (0, jmax (0, numRows), lastRow);
selected.addRange (Range<int> (jmin (firstRow, lastRow),
jmax (firstRow, lastRow) + 1));
selected.removeRange (Range<int> (lastRow, lastRow + 1));
}
selectRowInternal (lastRow, false, false, true);
}
I think this need to change:
selectRowInternal (lastRow, false, false, true);
to:
selectRowInternal (lastRow, true, false, true);
since selectedRowInternal
is declared as
void ListBox::selectRowInternal (const int row,
bool dontScroll,
bool deselectOthersFirst,
bool isMouseClick)
Maybe the solution is to request that a third parameter be declared for selectRangeOfRows
:
void selectRangeOfRows (int firstRow,
int lastRow,
bool dontScroll = false);
and the definition be changed to:
void ListBox::selectRangeOfRows (int firstRow, int lastRow, bool dontScroll)
{
if (multipleSelection && (firstRow != lastRow))
{
const int numRows = totalItems - 1;
firstRow = jlimit (0, jmax (0, numRows), firstRow);
lastRow = jlimit (0, jmax (0, numRows), lastRow);
selected.addRange (Range<int> (jmin (firstRow, lastRow),
jmax (firstRow, lastRow) + 1));
selected.removeRange (Range<int> (lastRow, lastRow + 1));
}
selectRowInternal (lastRow, dontScroll, false, true);
}