Empirical
Classes | Namespaces
Button.h File Reference

Create/control an HTML button and call a specified function when that button is clicked. More...

#include "Widget.h"

Go to the source code of this file.

Classes

class  emp::web::Button
 Create or control an HTML Button object that you can manipulate and update as needed. More...
 
class  emp::web::Button::ButtonInfo
 

Namespaces

 emp
 If we are in emscripten, make sure to include the header.
 
 emp::web
 

Detailed Description

Create/control an HTML button and call a specified function when that button is clicked.

Note
This file is part of Empirical, https://github.com/devosoft/Empirical
Date
2015-2017

Use example:

emp::web::Button my_button(MyFun, "Button Name", "html_id");

Where my_button is the C++ object linking to the button, MyFun is the function you want to call on clicks, "Button Name" is the label on the button itself, and "html_id" is the optional id you want it to use in the HTML code (otherwise it will generate a unique name on its own.)

Member functions to set state: Button & Callback(const std::function<void()> & in_callback) Button & Label(const std::string & in_label) Button & Title(const std::string & in_t) Button & Autofocus(bool in_af) Button & Disabled(bool in_dis)

Retriving current state: const std::string & GetLabel() const const std::string & GetTitle() const bool HasAutofocus() const bool IsDisabled() const