Navigation
Synopsis An interactive push button.
Function Figure button(str label, void () vcallback, FProperty props...)
Description A button with the text label. Whenever the user clicks on this button, callback vcallback is called. Typically, the callback causes a state change in the Rascal program (e.g., the value of a variable is changed) and this variable is used in another part of the figure.
Examples
public Figure inc(){
  int n = 0;
  return vcat([ button("Increment", void(){n += 1;}),
                text(str(){return "<n>";})
              ]);
}
render(inc());
b1

Clicking the button will increment the value of n.
Pitfalls Unfortunately we cannot show an interactive version of the above example here. Try it out in Rascal itself.
Is this page unclear, or have you spotted an error? Please add a comment below and help us to improve it. For all other questions and remarks, visit ask.rascal-mpl.org.