Browse Source

Added additional dontScrollToShowThisRange parameter to selectRangeOfRows in ListBox

tags/2021-05-28
luigisambuy 9 years ago
parent
commit
f5398fcab2
2 changed files with 9 additions and 5 deletions
  1. +2
    -2
      modules/juce_gui_basics/widgets/juce_ListBox.cpp
  2. +7
    -3
      modules/juce_gui_basics/widgets/juce_ListBox.h

+ 2
- 2
modules/juce_gui_basics/widgets/juce_ListBox.cpp View File

@@ -552,7 +552,7 @@ SparseSet<int> 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<int> (lastRow, lastRow + 1));
}
selectRowInternal (lastRow, false, false, true);
selectRowInternal (lastRow, dontScrollToShowThisRange, false, true);
}
void ListBox::flipRowSelection (const int row)


+ 7
- 3
modules/juce_gui_basics/widgets/juce_ListBox.h View File

@@ -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.


Loading…
Cancel
Save