' A slider control for smallbasic
' This implementtion produces a vlue of 0-1 which is used to control the size of an ellipse shape by percentage
' It could just as easily produce a value of 1-100 or 1-255
' Circle Shape to visualise the slider control's output
GraphicsWindow.BrushColor = "Aqua"
circle = Shapes.AddEllipse(400, 400)
Shapes.Move(circle, 300, 50)
updateCircle()
' Adjust circle's size based on slider position
Sub updateCircle
zoomFactor = (sliderValue * 0.9) + 0.1
Shapes.Zoom(circle, zoomFactor, zoomFactor)
EndSub
' Move the slider based on the mouse
Sub updateSlider
Shapes.Move(slider, sliderX - sliderRadius, sliderPos - sliderRadius)
sliderValue = 1 - (sliderPos-sliderTop) / sliderLength
' Show the value of the slider in the title
GraphicsWindow.Title = "Slider Value: " + sliderValue
EndSub