diff --git a/modules/juce_gui_basics/widgets/juce_ListBox.cpp b/modules/juce_gui_basics/widgets/juce_ListBox.cpp index 6445402f7e..e026d3d7fc 100644 --- a/modules/juce_gui_basics/widgets/juce_ListBox.cpp +++ b/modules/juce_gui_basics/widgets/juce_ListBox.cpp @@ -552,7 +552,7 @@ SparseSet ListBox::getSelectedRows() const return selected; } -void ListBox::selectRangeOfRows (int firstRow, int lastRow) +void ListBox::selectRangeOfRows (int firstRow, int lastRow, bool dontScrollToShowThisRange) { if (multipleSelection && (firstRow != lastRow)) { @@ -566,7 +566,7 @@ void ListBox::selectRangeOfRows (int firstRow, int lastRow) selected.removeRange (Range (lastRow, lastRow + 1)); } - selectRowInternal (lastRow, false, false, true); + selectRowInternal (lastRow, dontScrollToShowThisRange, false, true); } void ListBox::flipRowSelection (const int row) diff --git a/modules/juce_gui_basics/widgets/juce_ListBox.h b/modules/juce_gui_basics/widgets/juce_ListBox.h index 5a5c3a4a4f..ada3b5f65b 100644 --- a/modules/juce_gui_basics/widgets/juce_ListBox.h +++ b/modules/juce_gui_basics/widgets/juce_ListBox.h @@ -265,11 +265,15 @@ public: This will add these rows to the current selection, so you might need to clear the current selection first with deselectAllRows() - @param firstRow the first row to select (inclusive) - @param lastRow the last row to select (inclusive) + @param firstRow the first row to select (inclusive) + @param lastRow the last row to select (inclusive) + @param dontScrollToShowThisRange if true, the list's position won't change; if false and + the selected range is off-screen, it'll scroll to make + sure that the range of rows is on-screen */ void selectRangeOfRows (int firstRow, - int lastRow); + int lastRow, + bool dontScrollToShowThisRange = false); /** Deselects a row. If it's not currently selected, this will do nothing.