![]() |
|
Navigation |
Synopsis An interactive checkbox.
Function
Figure checkbox(str text, void(bool state) vcallback, FProperty props...)
Description A checkbox that can be selected or deselected by the user.
Whenever this occurs,
vcallback is called. The state argument of the callback is true when the check box is checked (= selected).
Examples
public Figure check(){ bool state = false; return vcat([ checkbox("Check me", void(bool s){ state = s;}), text(str(){return "I am " + (state ? "checked" : "unchecked");}, left()) ]); } render(check()); ![]() Checking the checkbox will change the variable state and this is reflected in the changed text.
Pitfalls Unfortunately we cannot show an interactive version of the above example here.
Try it out in Rascal itself.
Due to limitations in SWT this does not behave correctly when being placed over or under figures, so do not use them in overlay or mouseOver. ![]() |