Hi,
I was trying to create my custom menuItem that is basically a TextEditor that needs me to filters following choices of the menu. (For example if menu has items “banana”, “apple”, “lemon”, “orange”, if I type on TextEditor “orange” only items called “orange” are shown).
I done this PopupMenu::CustomComponent, but then when I try to type in TextEditor I can’t (and with right click on TextEditor, when the popupMenu containing “cut”, “copy”, ecc is shown, clicking on one item all popUps are closed…)
How can I?
this is my PopupMenu::CustomComponent
struct SearchPluginComponent : public PopupMenu::CustomComponent
{
SearchPluginComponent ()
: PopupMenu::CustomComponent (false)
{
addAndMakeVisible(searcher);
searcher.setWantsKeyboardFocus(true);
searcher.setText("filter", NotificationType::dontSendNotification);
searcher.setBounds(0, 0, idealWidth, idealHeight);
}
void getIdealSize (int& width, int& height) override
{
width = idealWidth;
height = idealHeight;
}
int idealWidth = 200;
int idealHeight = 24;
TextEditor searcher{"searcher"};
};
and in “showPopupMenu()”
//other stuffs....
PopupMenu pluginSubMenu;
std::unique_ptr<SearchPluginComponent> searcher = std::make_unique<SearchPluginComponent>();
pluginSubMenu.addCustomItem(-1, std::move(searcher));
mainWindow->addPluginsToMenu(pluginSubMenu);
//other stuffs....
Also… there’s a way (maybe a callback) to rebuild items in popupMenu…?
