Custom listbox and row number

I have a custom list box with checboxes inside it. I want to get Components which are selected. The idea is simple - to get all component and to check which of them have checked state.
The problem is that I cannot get all components, and I even cannot get total number of ones.

returns 1, but I have 6 items. The private field named

has correct value = 6 though. What’s wrong with getNumChildComponents() ?

What about getSelectedRows() ?

ok, say if checkbox in the item is toggled then set it selected. But how to set a row into selected state from inside item component? anyway, what’s with totalItems

Have your items pass state changes messages back to the model, and let the model keep track of the overall state.

I did this:

m_productsListBox->updateContent(); for(int i = 0; i < productDTOs.size(); ++i) { m_productsListBox->selectRow(i); m_productsListBox->getModel()->selectedRowsChanged(i); }

but

int rowNumber = m_productsListBox->getSelectedRows().size();

gives me 1 instead of 6

http://www.rawmaterialsoftware.com/juce/api/classListBox.html#ac56613db03adf964a683e184f7248640

Note the third parameter!

[quote=“valley”]http://www.rawmaterialsoftware.com/juce/api/classListBox.html#ac56613db03adf964a683e184f7248640

Note the third parameter![/quote]
it helped. Thank you