Skip to content

glgui verticalvaluepicker

Dustin edited this page Mar 21, 2014 · 6 revisions

glgui-verticalvaluepicker creates a vertically oriented value (number, string, or icon) picker. The picker displays the currently selected item with arrow (triangle) buttons above or below it for changing the value. steps can be a list specifying strings to be drawn in the picker or textures to be displayed in the picker (for using icons). The value displayed when first created is the smallest (or first) value. The current number or index of string or textures can be get or set as the 'value parameter of the widget. The 'callback is called on EVENT_BUTTON1UP (or after dragging outside the widget) after EVENT_BUTTON1DOWN on one of the up or down buttons.

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. The top and bottom arrow buttons each are a height of 45, with the selected item centered in the remaining h - 90.
vmin The minimum value in the value picker. If steps is a list of strings or textures, this parameter is not used.
vmax The maximum value in the value picker. If steps is a list of strings or textures, this parameter is not used.
colorarrows Color for the up and down triangle arrows
colorhighlight Color of the arrow button background when being pressed. When not being pressed these buttons have no background.
colorvalue Color of the value being displayed
colorbg Color of the background of the value picker. Set to #f for no background color.
font Font of the value being displayed. If steps is a list of textures, this parameter is not used.
steps Optional: Step size or values of steps, this is the step-size between adjacent values in the value picker, OR this is a list specifying strings or textures to be displayed as values.

Examples

Example 1: Create a number picker, with values from 1 to 6. Place on the gui at 10,10, 70px in width and 130 px high. The arrow buttons are grey with a blue highlight behind them when pressed. The number displayed is white and the background of the whole widget is black.

(glgui-verticalvaluepicker gui 10 10 70 130 1 6 Grey Blue White Black ascii_25.fnt)

Example 2: Create a minutes picker, with values from 00 to 55 in 5 minute steps. Place on the gui at 200,10, 70px in width and 130 px high. The arrow buttons are white with an orange highlight behind them when pressed. The number displayed is red and there is no background to the widget.

(set! minutes-list '("00" "05" "10" "15" "20" "25" "30" "35" "40" "45" "50" "55"))
(set! minute (glgui-verticalvaluepicker gui 200 10 70 130 #f #f 
  White Orange Red #f ascii_25.fnt minutes-list))

Clone this wiki locally