# Bug report: Discrepancies in Multiple selection in ListBox

**URL:** <https://forum.juce.com/t/bug-report-discrepancies-in-multiple-selection-in-listbox/5741>\
**Category:** General JUCE discussion\
**Created:** [October 5, 2010, 9:51pm UTC](https://forum.juce.com/t/bug-report-discrepancies-in-multiple-selection-in-listbox/5741 "2010-10-05T21:51:35Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![capyTan](https://avatars.discourse-cdn.com/v4/letter/c/7c8e57/32.png) [@capyTan](https://forum.juce.com/u/capyTan)\
**Post date:** [October 5, 2010, 9:51pm UTC](https://forum.juce.com/t/bug-report-discrepancies-in-multiple-selection-in-listbox/5741/1 "2010-10-05T21:51:35Z")

</div>

Juce version: GIT clone, taken at October 5, 2010.  
The bug is not platform-specific (checked under both Mac OSX [10.6.4] and WinXP [SP3])  
Occurence: Juce Demo app (Table Components demo, Drag-n-Drop demo) where it uses an instances of multiple-selectable ListBox component.

The Description of the problem:  
If the modifier key ==

1. Command(Mac)/Control(Win), then the behaviour of selection process differs depending on the order in which rows are selected.  
If the firstly selected row has smaller index than the row selected after it, then the ListBox selects a contiguous range of rows instead of just two rows, which is wrong (i.e. it behaves as if the SHIFT modifier key was pressed). Albeit, if the temporal order of selection is reversed, that is, the larger index comes first, then everything works as expected.

If the modifier key ==  
2) SHIFT then, on the surface, everything works (for the release build). But, if one runs the software under the debugger, then the SHIFT-selection, undertaken with smaller index coming first, hits jassert() somewhere in the guts of SparseSet::simplify() method. If the firstly selected row has larger index, then everything’s peachy.

---

<div class="post-metadata">

**Author:** ![jules](https://avatars.discourse-cdn.com/v4/letter/j/41988e/32.png) [@jules](https://forum.juce.com/u/jules)\
**Post date:** [October 7, 2010, 12:09pm UTC](https://forum.juce.com/t/bug-report-discrepancies-in-multiple-selection-in-listbox/5741/2 "2010-10-07T12:09:27Z")

</div>

ok… well, thanks for the lovely detailed error report, but I can’t reproduce any of this!

I’ve tried exactly what you suggest, but it all seems just fine. E.g. in the demo, on the drag-and-drop page, I hold down command and click row 5, then 2, and it all works. Try it the other way round, it still works. Shift works fine with no assertions…

???

---

<div class="post-metadata">

**Author:** ![masshacker](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/masshacker/32/650_2.png) [@masshacker](https://forum.juce.com/u/masshacker)\
**Post date:** [October 7, 2010, 12:22pm UTC](https://forum.juce.com/t/bug-report-discrepancies-in-multiple-selection-in-listbox/5741/3 "2010-10-07T12:22:35Z")

</div>

I tried this too. Jules, try to:  
-click row 2  
-hold cmd and click row 5

It will act as if shift was pressed. But if you do the inverse (first 5 then 2) it will be right.

---

<div class="post-metadata">

**Author:** ![jules](https://avatars.discourse-cdn.com/v4/letter/j/41988e/32.png) [@jules](https://forum.juce.com/u/jules)\
**Post date:** [October 7, 2010, 12:57pm UTC](https://forum.juce.com/t/bug-report-discrepancies-in-multiple-selection-in-listbox/5741/4 "2010-10-07T12:57:39Z")

</div>

Ok, I dug out the old 1.51 executable and tried that, and yes, that does seem to have a bug in it. But I fixed it a looong time ago - the tip version is absolutely fine. capyTan, you say you’re using the latest version from GIT, but I think you may be mistaken!

---

<div class="post-metadata">

**Author:** ![capyTan](https://avatars.discourse-cdn.com/v4/letter/c/7c8e57/32.png) [@capyTan](https://forum.juce.com/u/capyTan)\
**Post date:** [October 7, 2010, 1:18pm UTC](https://forum.juce.com/t/bug-report-discrepancies-in-multiple-selection-in-listbox/5741/5 "2010-10-07T13:18:25Z")

</div>

No, I used the latest version from GIT, but I just took the Juce Demo from the ‘prebuilt’ folder, the contents of which, as it turns out, doesn’t necessarily reflect the latest changes. I assumed it does.  
Thanks for clarifications!

---

<div class="post-metadata">

**Author:** ![jules](https://avatars.discourse-cdn.com/v4/letter/j/41988e/32.png) [@jules](https://forum.juce.com/u/jules)\
**Post date:** [October 7, 2010, 1:24pm UTC](https://forum.juce.com/t/bug-report-discrepancies-in-multiple-selection-in-listbox/5741/6 "2010-10-07T13:24:53Z")

</div>

Ah! I see. I can’t keep all the binaries updated because that’d make the repository humungous, so they generally only get updated when I do a release.
