Skip to content

inputBox

James Bremner edited this page Oct 18, 2019 · 1 revision

A popup window where user can enter values for name-value pairs

    // 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("A windex inputbox");

    wex::inputbox ib( form );
    ib.add("A","72");
    ib.add("B","4600");
    ib.choice("Choose", { "X", "Y"} );
    ib.showModal();

    std::string msg =
        "A is " + ib.value("A") +
        ", B is " + ib.value("B") +
        ", choice is " + ib.value("Choose");
    msgbox(
        form,
        msg );

    // show the application
    form.show();

Methods

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

void add( const std::string& name, const std::string& def ) add a name-value pair where user can edit value

void choice( const std::string& name, const std::vector<std::string>& choice ) add a name-value pair where user can choose value from options.

void modal() show inputbox, preventing other window interactions until user closes popup

std::string value( const std::string& name ) return value of name when user closed popup

Clone this wiki locally