rascal - pack figure doesn't work with computeFigure -
i seem have problem pack-figure , using computefigure.
below code reproduce behaviour have.
public void main() { bool redraw = false; str boxwidthprop = ""; figure topbar = hcat([text("width"), combo(["1", "2"], void(str s){ boxwidthprop = s; }, hshrink(0.1)) , button("redraw", void() {redraw = true; }, resizable(false))], vshrink(0.05), hgap(5)); figure gettreemap() { return computefigure(bool () { bool temp = redraw; redraw = false; return temp; }, figure() { int sz = 20; if (boxwidthprop == "2") sz = 100; b = box(size(sz, sz), fillcolor("red"), resizable(false)); t = text(str() {return "w: <sz>; prop: <boxwidthprop>"; }); figures boxes = []; boxes += b; boxes += t; //return pack(boxes, std(gap(5))); return vcat([t,b]); }); } vc = vcat([topbar, gettreemap()]); render(vc); }
when running code, new screen combo, button, label , box.
- when change combo you'll see value of label change.
- when click button box change (it's size).
- when change combo again, you'll see label change , clicking - button it's job again.
- this can continue.
now uncomment line "return pack ..." , comment "return vcat". run code again.
you see same screen.
- changing combo works.
- clicking button change box.
- but on stops.
- changing combo, nothing.
- clicking button, nothing.
my guess here there problem pack-figure. i'm total newbie rascal (and eclipse), might i'm missing something.
Comments
Post a Comment