# GLMakie: Reset all sliders inside SliderGrid via Button

**URL:** <https://discourse.julialang.org/t/glmakie-reset-all-sliders-inside-slidergrid-via-button/94555>\
**Category:** Visualization\
**Tags:** glmakie\
**Created:** [February 13, 2023, 12:35pm UTC](https://discourse.julialang.org/t/glmakie-reset-all-sliders-inside-slidergrid-via-button/94555 "2023-02-13T12:35:45Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![ellocco](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ellocco/32/31331_2.png) [@ellocco](https://discourse.julialang.org/u/ellocco)\
**Post date:** [February 13, 2023, 12:35pm UTC](https://discourse.julialang.org/t/glmakie-reset-all-sliders-inside-slidergrid-via-button/94555/1 "2023-02-13T12:35:45Z")

</div>

I wonder, if something exist like “Mouse.DoubleClick” on SliderGrid?  
The code below does what it should do, but it uses a for-loop over the SliderGrid.

```julia
using GLMakie

fig = Figure()
# --- figure set-up: two panes side by side, right one with two sub-panes: 
# --- left pane:
ax = Axis(fig[1, 1]) 

# --- right pane contains two sub-panes: [1,1]: top, [2,1]: bottom
# --- SliderGrid: right pane, top sub-pane:
sg = SliderGrid( fig[1, 2][1, 1], 
    (; label = "Voltage", range = 0:0.1:10, format = "{:.1f}V", startvalue = 5.3),
    (; label = "Current", range = 0:0.1:20, format = "{:.1f}A", startvalue = 10.2),
    (; label = "Resistance", range = 0:0.1:30, format = "{:.1f}Ω", startvalue = 15.9),
    width = 350,
    tellheight = false,
    )

# --- Button: right pane, bottom sub-pane:
bt = Button(fig[1, 2][2, 1]; label = "reset", tellheight = false, strokecolor = RGBf(0.94, 0.14, 0.24), strokewidth = 4)

# access elements inside slidergrid, each element is of type "Observable{Any}(Float64)"
# variable sliderobservables is a vector of "Observable{Any}(Float64)"
sliderobservables = [s.value for s in sg.sliders]

# build a vector of type "Observable" containing the value of each slider inside slider grid:
bars = lift(sliderobservables...) do slvalues...
    [slvalues...]
end

# reset all sliders inside SliderGrid "sg"
on(bt.clicks) do n # n = number of clicks
    for i_slider in sg.sliders
        set_close_to!(i_slider, i_slider.startvalue[])
    end
end

barplot!(ax, bars, color = [:yellow, :orange, :red])
ylims!(ax, 0, 30)

display(fig)

```
