MakieLayout - deleting Sliders (or GridPositions)

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

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[] = 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]

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



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.

1 Like

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.

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