Skip to content
James Bremner edited this page Oct 27, 2019 · 1 revision

User can select from list of options

    // construct top level window
    gui& form = wex::topWindow();
    form.move({ 50,50,400,400});
    form.text("Menu demo");

    int clicked = -1;

    menu m;
    m.append("test",[&]
    {
        clicked = 1;
    });
    m.append("second",[&]
    {
        clicked = 2;
    });
    m.append("third",[&]
    {
        clicked = 3;
    });
    m.popup( form, 200,200 );

    msgbox( form,std::string("item ") + std::to_string(clicked) + " clicked");

    form.show();

Methods

void append( const std::string& title, const std::function<void(void)>& f) Add menu item with finction to run when item selected.

void popup( gui& parent, int x, int y) Display menu at a location in the parent window.

Clone this wiki locally