|
| |
| 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());
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.
|