Hi Jules,
I have small combo boxes and would like to have a minimum height for the popup menu entries.
Currently I have overriden showPopup to achieve this but I cannot retrieve the label as it's private.
What would be the best way to achieve this ?
Thanks,
jules
2
Can you do it with a lookandfeel?
Nop, this is related to the PopupMenu creation in the combo box and I didn't see any override related to this in the LnF
I have to do this
namespace
{
static void comboBoxPopupMenuFinishedCallback(int result, juce::ComboBox* combo)
{
if (combo != nullptr)
{
combo->hidePopup();
if (result != 0)
combo->setSelectedId(result);
}
}
}
void MyComboBox::showPopup()
{
juce::PopupMenu menu;
menu.setLookAndFeel(&getLookAndFeel());
addItemsToMenu(menu);
menu.showMenuAsync(juce::PopupMenu::Options().withTargetComponent(this)
.withItemThatMustBeVisible(getSelectedId())
.withMinimumWidth(getWidth())
.withMaximumNumColumns(1)
.withStandardItemHeight(std::max(14, /*label->*/getHeight())),
juce::ModalCallbackFunction::forComponent(comboBoxPopupMenuFinishedCallback, (juce::ComboBox*)this));
}
But I would'nt mind being able to do it in the LnF FWIW
lalala
4
in the lnf you can change the font height in Font getPopupMenuFont(), that should work
By the way it would be great if it was : getPopupMenuFont (PopupMenu&)
There are a few methods like that in the lnf, without any ref to the component, and that's often annoying
1 Like
It seems getIdealPopupMenuItemSize can do the trick.
Thanks,