replace step textbox with slider

pull/3/head
Nikola Sebastian Munder 2025-06-11 11:44:36 +02:00
parent d50c843709
commit 2819c48076
1 changed files with 11 additions and 9 deletions

View File

@ -132,7 +132,17 @@ fig[2, 1] = buttongrid = GridLayout(ax.scene, tellwidth=false)
btn_step = Button(buttongrid[1, 1], width=50, label="Step")
btn_start = Button(buttongrid[1, 2], width=50, label=run_label)
btn_reset = Button(buttongrid[1, 3], width=50, label="Reset")
step_box = Textbox(buttongrid[1, 4], width=50, validator=Int, placeholder="Stepsize", stored_string="$(stepsize[])")
slidergrid = SliderGrid(fig[3, 1], (label="Speed", range=1:1:100, format="{}x", width=350, startvalue=stepsize[]))
speed_slider = slidergrid.sliders[1].value
on(speed_slider) do s
try
stepsize[] = s
println("Changed stepsize to $s")
catch
@warn "Invalid input for $s"
end
end
gh[1, 2] = textboxgrid = GridLayout(ax.scene, tellwidth=false)
rowsize!(gh, 1, Relative(1.0))
@ -170,15 +180,7 @@ on(running) do r
run_label[] = r ? "Pause" : "Run"
end
on(step_box.stored_string) do s
try
stepsize[] = parse(Int, s)
println("Changed stepsize to $s")
catch
@warn "Invalid input for $labeltxt: $s"
end
end
# Button Listeners
on(btn_step.clicks) do _
multi_step!((U, V), stepsize[])