Horizontal ListBox


#1

I have an idea to use a Horizontal ListBox… and before I dig in I was wondering if it would be better to create a whole new Component from scratch or should I try and mangle the existing JUCE (Vertical) ListBox to do what I want…

My options are:

a) Create a new Horizontal ListBox component from scratch
b) Subclass JUCE’s (vertical) ListBox

  • or -
    c) Copy JUCE’s (vertical) ListBox and use that as a base for creating my new Horizontal ListBox

Just thought I’d ask for an opinion before I dig into this…

Best,

Rail


Horizontal [ViewModel]
#2

Hard to know what's the best answer to that..

If I was going to write a horizontal listbox to add to the library, the simplest solution would probably be to extend the vertical one with extra options to use other directions, but for you to write your own.. Not sure, TBH. Copying the existing code and modifying it is probably not such a bad choice, because it'll be easy to do, and the class is pretty stable so is a good base to start from.


#3

I don't know if this applies to the listbox since I haven't looked much at how that class is used, but when I needed a horizontal treeview I did the following:

1: I rotated the treeview container component 90 degrees...

2: And then I subclassed the treeViewItemComponent class, and inside it, I rotate everything in the opposite direction where needed, so that it still looks horizontal.

In a different component your mileage may vary, but for me it was easy once Ive figured out the transformations!

 


#4

Thanks Jules. I was leaning towards option © so I’ll give that a go… although I may end up with option (a).

Thanks onar3D, I hadn’t thought of even trying that approach… I’m not sure it’d work for my intentions… but thanks for the input.

Best,

Rail