# MakieLayout - deleting Sliders (or GridPositions)

**URL:** <https://discourse.julialang.org/t/makielayout-deleting-sliders-or-gridpositions/66879>\
**Category:** Visualization\
**Tags:** makie, makielayout, glmakie\
**Created:** [August 23, 2021, 10:32pm UTC](https://discourse.julialang.org/t/makielayout-deleting-sliders-or-gridpositions/66879 "2021-08-23T22:32:41Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![JCQ](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jcq/32/32032_2.png) [@JCQ](https://discourse.julialang.org/u/JCQ)\
**Post date:** [August 23, 2021, 10:32pm UTC](https://discourse.julialang.org/t/makielayout-deleting-sliders-or-gridpositions/66879/1 "2021-08-23T22:32:41Z")

</div>

Here is a code snippet for the problem that I am having:

```julia
using GLMakie,Colors,GeometryBasics

fig = Figure(resolution = (1920, 1080))

plot_scene = LScene(fig[1,1], scenekw=(camera = old_cam3d!,show_axis = false),tellwidth = true)
plot_scene.scene.clear=true
plot_scene.scene.center[] = false

slider = Slider(fig[2,1],range=0.0:0.01:10.0, startvalue = 0.0,tellwidth = false,tellhight = true)

x = Node([0.0])
lift(slider.value) do val
  x[] = [val]
end

scatter!(plot_scene.scene,x,[0.0],[0.0],color =:black,markersize=300.0)

#delete!(slider)

display(fig)

```

Changing the value of the slider changes the position of a scatter point, to visualize that the slider is working.

What I want to do now, is to delete/remove the slider (and ideally add it again later).

The best thing I could find was `delete!(slider)`. However, this just seems to remove the “visual part” of the slider, not the “interactive part”. Meaning, you can drag the mouse over the area where the slider used to be and still move the scatter point, even thought the slider is not visible anymore.  
Furthermore, adding the slider back in by using `slider = Slider(fig[2,1],range=0.0:0.01:10.0, startvalue = 0.0,tellwidth = false,tellhight = true)` makes a slider visible again, but the slider point does not move when dragging it.

Naively, I think that I should be able to solve this by removing/clearing the GridPosition the slider is assigned to. But I could not find documentation of a function that does this.

Any ideas on how to solve this are greatly appreciated.

---

<div class="post-metadata">

**Author:** ![jules](https://avatars.discourse-cdn.com/v4/letter/j/41988e/32.png) [@jules](https://discourse.julialang.org/u/jules)\
**Post date:** [August 24, 2021, 5:21am UTC](https://discourse.julialang.org/t/makielayout-deleting-sliders-or-gridpositions/66879/2 "2021-08-24T05:21:48Z")

</div>

Hm this probably means that the slider internals should be cleaned up better when delete! is called. It seems that the observables are still in effect so you keep the behavior that you see, and when you add the second slider the remnants of the first might steal the mouse events from it. In general Makie has some rough edges when it comes to cleanly removing things, as observables complicate that a bit.

---

<div class="post-metadata">

**Author:** ![JCQ](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jcq/32/32032_2.png) [@JCQ](https://discourse.julialang.org/u/JCQ)\
**Post date:** [August 25, 2021, 11:13pm UTC](https://discourse.julialang.org/t/makielayout-deleting-sliders-or-gridpositions/66879/3 "2021-08-25T23:13:47Z")

</div>

Okay, I will just have to live with that.  
Thank you for the quick response anyway.
