I am working on an interface containing combo boxes with a lot of items in it. When one of the combo box's popup menu is deployed, it takes most of the time a huge part of the screen. What I would like to do is to restrict the number of items displayed by the popup menu and enable the scrolling.
There’s apparently no way to do this using a custom lookandfeel or a custom combo box as the popup menu display is computed in an inline class called MenuWindow in juce_PopupMenu.cpp.
..actually, just thinking about it, you can probably already do this.
If you override the ComboBox::showPopup method, you can tweak the options, and could use the Options::withTargetScreenArea to limit the space it can occupy.
Sorry, what I said was wrong - the target screen area is the area to position the menu around, not inside. There's currently nothing in there that would support limiting the overall size, but it could be added to the options, I guess.
Yeah, this would be a nice feature. Am I missing another way this could be achieved? The size of the menu doesn’t look so nice depending on the size of the plugin window, so it’d be nice to have more control.
That would be possible if I was using the popup menu on its own but it’s being created in the ComboBox, so I think I can only change things with the getOptionsForComboBoxPopupMenu method.
Yes, you could provide a parent component with that function. But you will have to create a LAF for each combobox I have done something similar to restrict the popup menu to the main editor.