Project

General

Profile

Bug #3994 ยป Example.cpp

Markus S, 04/20/2015 02:54 PM

 
namespace
{
class TestContextMenu
: public Wt::WApplication
{
public:
TestContextMenu( const Wt::WEnvironment& env )
: Wt::WApplication( env )
{
auto button = new Wt::WPushButton( "OpenPopupMenu" );
button->clicked()
.connect( []( Wt::WMouseEvent e )
{
auto popup = new Wt::WPopupMenu();
popup->addItem( "MenuItem 1" )->triggered()
.connect( [](...){ Wt::WMessageBox::show( "Ok", "MenuItem 1 Triggered", Wt::Ok ); } );
popup->exec( e );
});
root()->addWidget( button );
}
};
}
    (1-1/1)