ListBox: hiding scrollbars and headers

I just started trying out Juce for the last day or so. It seems well designed and I was able to get started pretty easily smiley. I was trying to make a listbox with images and I have a couple of questions about listboxes:

  1. I wanted to get rid of the scrollbar in the Listbox and control the scrolling some other way, such as with separate buttons, and then call setVerticalPosition() to control the scrolling. But I didn't see any way to remove the scrollbar. Is it possible? Or is there some other approach to accomplish that such as using a different control?
     
  2. A ListBox is only vertical and I wanted to try horizontal. So I figured that would be doable by using a TableListBox and telling it I only wanted one row. But it seems in order to get any columns you need to set up the table header and then the header is visible, and I didn't want a header at all. You can setVisible(false), but it still takes up the space. Again, is there another way to accomplish any of that?
    (What might be nice would be a two-dimensional list control, like a grid. Then derive a table control from that which has the header.)

Thanks,

Jim

  1. check out the LookAndFeel classes

  2. I posted a question recently about creating a horizontal listbox. I ended up creating one from scratch using the Viewport class since that seemed the fastest approach for myself. The JUCE ListBox could be rewritten/modified otherwise if you have the time to modify the internal Viewport class it uses. Doing the modification shouldn’t take too long, but testing for all the edge cases may take some time, which is why I opted for option A.

https://forum.juce.com/t/horizontal-listbox

Rail

1. Thanks, I was thinking about LookAndFeel also. Then I just found that I can get the viewport and control it there:

        mylistbox.getViewport()->setScrollBarsShown(false,false);

It always happens that I only figure things out after I make the post.

2. You might be right that it's worth considering to change the existing ListBox than to muck around with the TableListBox. I'll look at that.

 

Jim

1 Like