TableListBox Multi selection behavior broken?


#1

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 ?

Thanks,


#2

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


#3

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

Thanks,


#4

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


#5

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

Thanks,


#6

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.

Thanks,


#7

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


#8

Bump (regarding the broken multi selection)

Thanks,


#9

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


#10

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


#11

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

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

DummyTableListBoxComponentWrapper::mouseDown
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 ?

Thanks,


#12

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


#13

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.

Thanks,


#14

Just do it in TableListBoxModel::selectedRowsChanged() ?


#15

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

Thanks,


#16

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


#17

oki doki