Browse Source

Accessibility: Fix issue with ListBox selection duplication

v6.1.6
ed 4 years ago
parent
commit
c933ad5a16
1 changed files with 13 additions and 5 deletions
  1. +13
    -5
      modules/juce_gui_basics/widgets/juce_ListBox.cpp

+ 13
- 5
modules/juce_gui_basics/widgets/juce_ListBox.cpp View File

@@ -295,15 +295,23 @@ public:
setViewedComponent (content.release());
}
RowComponent* getComponentForRow (const int row) const noexcept
RowComponent* getComponentForRow (int row) const noexcept
{
return rows [row % jmax (1, rows.size())];
if (isPositiveAndBelow (row, rows.size()))
return rows[row];
return nullptr;
}
RowComponent* getComponentForRowWrapped (int row) const noexcept
{
return rows[row % jmax (1, rows.size())];
}
RowComponent* getComponentForRowIfOnscreen (const int row) const noexcept
RowComponent* getComponentForRowIfOnscreen (int row) const noexcept
{
return (row >= firstIndex && row < firstIndex + rows.size())
? getComponentForRow (row) : nullptr;
? getComponentForRowWrapped (row) : nullptr;
}
int getRowNumberOfComponent (Component* const rowComponent) const noexcept
@@ -377,7 +385,7 @@ public:
{
const int row = i + startIndex;
if (auto* rowComp = getComponentForRow (row))
if (auto* rowComp = getComponentForRowWrapped (row))
{
rowComp->setBounds (0, row * rowH, w, rowH);
rowComp->update (row, owner.isRowSelected (row));


Loading…
Cancel
Save