Project

General

Profile

Bug #11103 ยป popup_submenu.cpp

Max Quatember, 11/23/2022 09:53 AM

 
class TestPopupSubMenu
: public Wt::WApplication
{
public:
TestPopupSubMenu( const Wt::WEnvironment& env )
: Wt::WApplication( env )
{
auto b = root()->addNew< Wt::WPushButton >( "show WPopupMenu" );
b->clicked().connect( [=]( const Wt::WMouseEvent& me )
{
auto popup = root()->addChild(std::make_unique<Wt::WPopupMenu>());
auto item = popup->addItem( "0" );
item->triggered().connect( [=]
{
root()->addNew< Wt::WBreak >();
root()->addNew< Wt::WLabel >( "triggered 0" );
});
auto sub = std::make_unique< Wt::WPopupMenu >();
auto subItem = sub->addItem( "1" );
subItem->triggered().connect( [=]
{
root()->addNew< Wt::WBreak >();
root()->addNew< Wt::WLabel >( "triggered 1" );
});
item->setMenu( std::move( sub ) );
item->setSelectable( true );
popup->popup( me );
});
}
};
    (1-1/1)