![]() |
|
Navigation |
Synopsis Interactive slider.
Function
Figure scaleSlider(int() low, int high(), int () selection, void(int) callback)
Description Create an interactive slider that can be used to interactively control an integer parameter.
The arguments are as follows:
Examples We now use the
scaleSlider to interactively control the size of a box.
Observe that:
Figure scaledbox(){ int n = 100; return vcat([ hcat([ scaleSlider(int() { return 0; }, int () { return 200; }, int () { return n; }, void (int s) { n = s; }, width(200)), text(str () { return "n: <n>";}) ], left(), top(), resizable(false)), computeFigure(Figure (){ return box(size(n), resizable(false)); }) ]); } render(scaledbox()); ![]() Moving the slider will change the size of the box.
Pitfalls 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.
Unfortunately we cannot show an interactive version of the above example here. Try it out in Rascal itself. ![]() |