TableListBox Multi selection behavior broken?


Hi Jules,

I’m seeing something unusual which I think didn’t use to happen in previous version.

If you enable multi selection in the TableListBox, then select multiple items, clicking on an item of this selection won’t change the selection.
This is quite annoying especially if all items are selected and if you don’t have an empty space in the list to un select everything.

Was this intentional ?



No, not intentional, I’ll take a look and see what I can do…


Don’t know if the latest commit regarding TableListBox should have fixed this, but it’s still happening.



Yes, I fixed it, and it works fine in the juce demo… (?)


Works fine now.
I had to update my proxy to forward event when an item was a label for mouseUp as well.



Hi Jules,

It seems this is broken again using command key to select multiple row

Both mouseDown and mouseUp call selectRowsBaseOnModifierKeys which call flipRowSelection,
so on mouse down it selects the row and on mouse up it deselect it.



I just wanna throw this out there now, but regarding the multi-select code for ListBox - while functional, does not efficiently support lists with hundreds of thousands or millions of rows.

There are methods of implementation, using a small amount of caller-provided storage for each row, that allow typical operations to execute in O(1) instead of O(n). For example, select all, deselect all, adding or removing a row from the selection, or determining if a row is selected, can all execute in O(1) if we allow for a bit of extra storage per row (two integers and a pointer).


Bump (regarding the broken multi selection)



Sorry, I hadn’t noticed your post! Will take a look today.


erm… no, it seems to be working fine for me (?)


Just checked the demo and indeed it works fine in the demo.

There is something I don’t get looking at the code though

calls selectRowsBasedOnModifierKeys
when isCommandDown is true then it call flipRowSelection
the row is not yet selected so it calls selectRowInternal
the row is now selected

now on DummyTableListBoxComponentWrapper::mouseUp
it calls selectRowsBasedOnModifierKeys
when isCommandDown is true then it call flipRowSelection
and as the the row is selected it calls deselectRow

Am i missing something ?



I don’t understand what you’re referring to…? What’s “DummyTableListBoxComponentWrapper”?


oh I see the issue might be in my code then :smiley:

I’ve create a dummy wrapper around custom editor component in the tableList box so it selected when you click those editors as well.
look like my fowards to achieve this behaviour are wrong

What would be the best way to achieve this ?

For example you have a combobox in the TableListBox and you want that the selection in the combobox select the row where the combo box is.



Just do it in TableListBoxModel::selectedRowsChanged() ?


I meant to forward the mouse click event which is not catch by the RowComponent but by the custom component in the column.



Hmm, not sure. You could probably use addMouseListener to get the event, and just select the row.


oki doki