Skip to content
James Bremner edited this page Oct 17, 2019 · 2 revisions

A widget that user can click to initiate an action

    // reference the windex gui framework
    windex& W = windex::get();

    // construct top level window
    window& form = W.MakeWindow();
    form.move({ 50,50,400,400});
    form.text("Label and Editbox demo");

    // display a button
    button& btn = W.make<button>( form );
    btn.move( {20, 100, 150, 30 } );
    btn.text( "Show values entered" );

    // do something when button is clicked
    btn.events().click([&]
    {
        ..code...
    });

void move( const std::vector<int>& v ) locate and size. v specifies left, top, width, height in pixels

void text( const std::string& t ) specify text to be displayed

eventhandler& events() get reference to eventhandler ( used to register code to execute when button is clicked )

Clone this wiki locally