Good one, thanks Shashi! I adjusted it a bit to make sure that the lower bound is always one less than the upper one. This works perfectly (the last two lines in the vbox are just to display and show that u and ll are correct):
u = Input(100) l = Input(0) mymin(u,l) = u > l ? l : u - 1 ll = lift(mymin, u, l) function main(window) push!(window.assets, "widgets") vbox(slider(1:100, value = 100) >>> u, consume(u) do x slider(0:(x - 1), value = 0) >>> l end, u, ll ) end Yakir Gagnon The Queensland Brain Institute (Building #79) The University of Queensland Brisbane QLD 4072 Australia cell +61 (0)424 393 332 work +61 (0)733 654 089 On Wed, Nov 4, 2015 at 2:59 PM, Shashi Gowda <shashigowd...@gmail.com> wrote: > Hi Yakir, > > you're right l will only update in response to user action. > > how about using l′ = lift(min, u, l) instead of l? > > > On Wed, Nov 4, 2015 at 8:53 AM, Yakir Gagnon <12.ya...@gmail.com> wrote: > >> OK, there is a problem with this: >> the new slider that gets created every time we update u doesn’t update l. >> l gets updated only after we try to change its subscribed slider, not >> before. This is problematic because I lifted l and u and if they’re >> overlapping then I get errors. >> I’ll get back to this… >> >> On Wednesday, November 4, 2015 at 11:43:08 AM UTC+10, Yakir Gagnon wrote: >> >> I thought others might find this useful: >>> Two sliders that don’t overlap. The second’s upper bound is >>> automatically adjusted so not to overlap with the first’s value. >>> >>> u = Input(100) >>> l = Input(0) >>> function main(window) >>> push!(window.assets, "widgets") >>> >>> vbox(slider(1:100, value = 100) >>> u, >>> consume(u) do x >>> slider(0:(x - 1), value = 0) >>> l >>> end >>> ) >>> end >>> >>> >>> >> >> > >