Horrible ComboBox

JUCE 6.1.6 Android/iOS

Show a ComboBox with many items on a smaller display (Android or iOS in landscape for example). Now click on one of the last items and re-open the combobox. The popup menu now shows an alien (to the platform) up arrow and you cannot scroll the list in a normal fashion. You have to press an item an drag it up to scroll up which all feels very unnatural. Any solutions to this or a way to open a custom dialog instead on the ComboBox press?

This is one of the reasons that for anything past a simple one page or synth-type GUI, I typically recommend using native UI or mixed JUCE + native.

There might be a way to make it look and feel more mobile native but it is a fiddly process with usually sub-optimal results.

On mobile devices the ComboBox is only useful if you have just a few items. It’s indeed quite horrible otherwise.

You could replace the ComboBox with a TextButton which then opens a PopupMenu. Look at the method showMenuAsync() for this. You have options to set the position of the menu, it’s size, which items are visible, etc. You can’t control everything but that might already be enough.

This is also a great improvement (I really don’t understand why it hasn’t been implemented): Improving PopupMenu for touch screens

Anternatively you could have the TextButton open a custom component. I made my own “menu within a window” using a ViewPort and a TreeView. It can be scrolled by dragging and sub-menus can be easily expanded and closed. It required modifying the JUCE codebase here and there but I’m very happy with the result. In fact, I think its considerably nicer than anything I could have done using the native UIs.

4 Likes

Well, for a library that is intended for cross-platform use, no native code should be necessary for basic controls. Anyway, I ended up overriding showPopup() and opening my own custom Component showing a basic list view (I don’t need submenu’s which makes things easier).

4 Likes

Do you mind sharing your fork or your modifications as this sounds very useful! Thanks.

Sure! I can gladly share it but I need to do quite a bit of code cleanup first and I’ll probably manage only in a couple of weeks.