Skip to content
Chris Petersen edited this page Oct 16, 2014 · 1 revision

glgui-slider creates a slider widget

Parameter Description
g Graphical User Interface (GUI) for this widget
x Lower left corner along the x-axis in pixels
y Lower left corner along the y-axis in pixels
w Width of the element in pixels
h Height of the element in pixels
vmin Minimum value of the slider, which is the left end
vmax Maximum value of the slider, which is the right end
icon Icon texture/pixmap for the minimum end of the slider
coloricon Color for the icon min (left) image
colorvalue Color of the horizontal bar, and also if shown, the colour of the text for the current value and the colour of the labels underneath the bar
colorhandle Color of the slider handle
bgcolor Background color. If false no background is drawn
font1 Font for the current value string, if shown. Default: not shown
font2 Font for the labels along the scale, if shown. Default: not shown
icon2 Second icon, that goes to the right of the bar - past the max value
coloricon2 Color for the icon max (right) image
steps Optional: Step size or values of steps, this is the step-size between adjacent locations the slider can sit

Example

Example1: Create a slider in gui with x=20, y=20, width=280, and height=60. The slider should range from 1 - 5. There are two icons, one to the left of the slider and one to the right, each specified to be white. However, none are used here for simplicity (otherwise replace both #f's with their respective texture.img). The horizontal bar and labels underneath it will also be white, while the slider knob/handle will be orange and the background will be black. The labels under the bar will be in num_20.fnt (which must be supplied by the application) and if 'showvalue is set to true then the current value is shown as a string using num_25.fnt (also must be supplied by application).

(set! sl (glgui-slider gui 20 20 280 60 1 5 #f White White Orange Black  
  num_25.fnt num_20.fnt #f White))
(glgui-widget-set! gui sl 'showvalue #t)
Clone this wiki locally