Unrelated components on top of each other



I have two sibling components, each containing a ComboBox as a child.

The two sibling components are arranged in two rows, one above the other.

Supposed that the in the top components ComboBox contains enough items that when opened, it should be seen on top of the bottom components,

how can I achieve this functionality?

Currently, when opened, the ComboBox is clipped behind the bottom component…



I don’t understand your question - when a combobox is opened, it always pops up in front of other windows…?


My code does what illustrated in the top of the image, I want to achieve the bottom functionality…


The combobox opens a new floating window to show its listbox - just like any other pop-up menu. There’s no way you could get it to do what you’ve drawn there.


Are you still using a ListBox to display the menu, instead of a PopupMenu?


You caught me :slight_smile:

I tried to alter the LookAndFeel (adding a virtual drawComboBox(…, Component&) as we discussed) but it was too much for me, I just started working with Juce…

The ListBox+Button works very nicely, the only problem left is what I describe here…

I would go for the solution we discussed earlier if I could work it all out…


You caught me :)[/quote]

If you insist on using a ListBox instead of a PopupMenu, then put it in its own window (i.e. heavyweight Component) so it can float over everything. You can copy the code from PopupMenu.


I don’t see what was so complicated about patching juce_ComboBox.cpp to build the menu using a virtual function…


I just had a look at ComboBox, and adding a virtual method to create the menu would be a bit awkward because it’d also mean exposing the internal ItemInfo class, and the item list, etc… I’m not really keen to break the encapsulation there.


I don’t see what was so complicated about patching juce_ComboBox.cpp to build the menu using a virtual function…[/quote]

After I had added the drawCombo(Component&) and changed the drawCombo(ComboBox&) to use it, what do I do then?

Derive from LookAndFeel and set it as the LookAndFeel of a new control deriving from ComboBox?


I never did understand why there is a separate ItemInfo…why not just keep a PopupMenu internally?


Good question. There’s probably a good answer, but I’d have to do some digging to find out - it’s a very long time since I wrote that stuff!