Hi I’m trying to make a submenu, I’ve created it, and it looks fine.
The problem is returning what is selected, as I can’t distinguish between the main menu and a sub menu in the returning data as it’s only one ‘int’
popupMenu.showMenuAsync(PopupMenu::Options().withTargetComponent(&presetBox),
[](int v)
{
// 'v' is the item selected, but from which menu?
});
The returned int is the ID of the item in the PopupMenu. When you populate the menu, it is your responsibility to make sure, that the IDs are actually unique.
Best practice is to start each menu or submenu with a fixed offset, so you can easily distinguish later on.
Just one thing, quickly. The button that opens the popup has a roll-over highlight. But this stays on as the mouse goes to the menu item, and never turns off until I go all the way back over it again. Is there a way of manually turning off the roll over effect? I need it to exist for plug-in consistency.
Do you mean the combo box field? I ran into the same issue, its “hover” effect hardly works. It should work like the button, but it doesn’t and it’s not usable.
mouse over uses the same graphic as off state but has a faint white tint when the mouse goes over it.
Unfortunately it the tint stays on even though my mouse has moved away, and it forgets it was even on until I go back.
I just tried calling presetBox.repaint() after the menu item has been chosen but it remains highlighted.
mouseExit is not called on the button, and I can’t call updateState (false, false) as it’s private.
I presume mouseExit is not called because it enters the menu state.