Listbox - Remove the scroll arrows


#1

Hi.

Is there a way to rid of the scroll arrows in ListBox?

I want to create a custom component which includes a ListBox which is too small to show all of it’s elements.

In that case scroll arrows appear - can I remove them somehow?

Thanks.


#2

You mean get rid of the scrollbar? Just don’t add more than a screen worth of rows…


#3

Well, I’m trying to create a ComboBox which contains a Component out of a ListBox and a Button.

The ListBox will contain the components and the Button will function as an open/close of the ListBox.

I figured I will remove the scroll arrows when the ComboBox is closed and its height set to the height of exactly one element and will display the scroll arrows when the ListBox is open (height set to n elements and scroll of needed)…


#4

What’s wrong with using a PopupMenu ?


#5

I need a ComboBox with ImageButtons :slight_smile:


#6

PopupMenu items can be custom components


#7

PopupMenu items can be custom components[/quote]

But it doesn’t act or look like a ComboBox… Its a big compromise…


#8

A ComboBox uses a PopupMenu internally. If your goal is to make a control that acts like a ComboBox but has custom Components for some or all of its menu items, the easiest solution is to make a copy of the juce ComboBox and modify ComboBox::showPopup() to create the menu with your items.

In fact, if Jules could tweak the ComboBox so that the function that builds the menu is in a separate virtual, you could re-use the existing control.


#9

A ComboBox uses a PopupMenu internally. If your goal is to make a control that acts like a ComboBox but has custom Components for some or all of its menu items, the easiest solution is to make a copy of the juce ComboBox and modify ComboBox::showPopup() to create the menu with your items.

In fact, if Jules could tweak the ComboBox so that the function that builds the menu is in a separate virtual, you could re-use the existing control.[/quote]

Got it. Well, for now I will copy the control but I hate doing that as I have to maintain it after juce updates…

Thanks…


#10

A ComboBox uses a PopupMenu internally. If your goal is to make a control that acts like a ComboBox but has custom Components for some or all of its menu items, the easiest solution is to make a copy of the juce ComboBox and modify ComboBox::showPopup() to create the menu with your items.

In fact, if Jules could tweak the ComboBox so that the function that builds the menu is in a separate virtual, you could re-use the existing control.[/quote]

Its not enough - there’s LookandFeel changes that has to be done because you don’t derive from ComboBox…


#11

You have three options:

  1. Make a copy of the relevant LookAndFeel methods and add it into your duplicate of juce_ComboBox.cpp

  2. Change ComboBox::showPopup() in juce_ComboBox.cpp to call a new virtual function ComboBox::buildMenu(), and generate a patch for it. You will need to re-apply the patch every time you get the latest tip

  3. Ask Jules to integrate change #2 into the tip.

I would go for #2 and #3.

Perhaps you should start a new post entitled “Request: virtual ComboBox::buildMenu()”