updating widgets without really pushing
yakir12 opened this issue · 2 comments
OK, I found the culprit (in reference to and completely independent of the specific problem resolved by #32). Consider the following example. I'm sure that push
ing into the slider
, which is triggered by updates to the slider
, is causing this to crash:
using GtkReactive, Gtk.ShortNames
w = Window("a")
s = slider(0:10)
b = Box(:v)
push!(b, s)
foreach(s) do t
if t > 5
push!(s, 5) # problematic
end
end
foreach(s) do t
push!(b, label(string(t + rand())))
showall(w)
end
push!(w, b)
showall(w)
In the actual code I'm writing, I allow the user to adjust some inputs (textarea
, dropdown
, spinbutton
), then press an "OK" button
, and then some things happen accordingly. But, I also need to update the same inputs according to what the user pressed OK to (thus automatically advancing the spinbutton
s etc). I guess what would be cool, is if those updates wouldn't propagate further (cause they were caused by the machine, not the user, and where intended only as a guess to what the user might want next round).
There's simply no way
foreach(s) do t
if t > 5
push!(s, 5) # problematic
end
end
can work, because pushing a single value triggers an endless recursion. Just use signal(s).value = 5
to bypass the trigger.
Since this isn't an issue with this package, I'll close this.
OK, thanks.