-
Notifications
You must be signed in to change notification settings - Fork 2
editbox
James Bremner edited this page Oct 17, 2019
·
1 revision
A widget where the user can enter a text
// 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 label
label& lbA = W.make<label>( form );
lbA.move( {20, 20, 100, 30 } );
lbA.text("A:");
// display editbox
editbox& edit1 = W.make<editbox>( form );
edit1.move( {80, 20, 100, 30 } );
edit1.text( "type value");
// display a button
button& btn = W.make<button>( form );
btn.move( {20, 100, 150, 30 } );
btn.text( "Show values entered" );
// popup a message box when button is clicked
// showing the value entered in textbox
btn.events().click([&]
{
std::string msg =
"A is " + edit1.text();
msgbox(
form,
msg );
});
form.show();
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 initial text to be displayed
std::string text()
returns text currently showing in editbox