ListBox selection stuff

This is a bit of a pointless post, not really a request, not really a problem or anything… just a bit of a gripe.

In a listbox, the selection stuff is handled with a SparseSet. That’s fine when you just have a listbox component, and you’re using it ‘as is’. However, I’ve been doing lots of stuff with things kept about elsewhere, where the selection of items needs to be stored.

Juce has the very nice ‘SelectedItemSet’ for storing selections of various types (i’m using int Ids in my case), but it’s not really much use in conjunction with a listbox - the selection logic is already handled in ListBox. So, I’ve just been using an array of ints to hold my IDs.

The gripe that I have is that ListBox feels a bit like it’s just doing its own thing, and the SparseSet isn’t really ‘compatible’ with anything else. It’s not exactly a major problem, but it’s quite tedious to have to keep doing conversions when there’s little use for the ‘sparseset’ form elsewhere.

I haven’t really thought of a solution or anything, and it’s not crippling, it just feels like it could be tweaked a bit. Perhaps it could have an associated SelectedItemSet or something.

I just thought I’d post because it’s been bugging me for a while now, and I may as well mention it in case anyone else thinks it could be improved too.

Yeah, good point, actually. I’ll need to remind myself how those classes work, because there might be a good reason it’s done that way, but it’s the sort of thing I’ll have a look at next time I’m doing some tinkering.