Skip to content
Chris Petersen edited this page Oct 16, 2014 · 8 revisions

glgui-dropdownbox create a dropdown box widget for choosing from a list of items. If there is not enough space below the box for the list to show it opens above the selected item.

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
lst List of procedures for drawing the items to choose from
arrowcolor Color of the arrow icon
bgcolor Widget background color
bordercolor Drop down list border color, also goes between items. If procedures for drawing list items have alpha and the bgcolor has alpha (or is false) than the border color will show through

Example

Example 1: Make a dropdownbox at x=140,y=200, width 150, height 40 which has three entries, which are the strings "Ear" "Hand" and "Foot"

(define field_gradient (list (color:shuffle #xe8e9eaff) (color:shuffle #xe8e9eaff) (color:shuffle #xfefefeff) (color:shuffle #xfefefeff)))
(glgui-dropdownbox gui 140 200 150 40
   (map (lambda (str)
     (lambda (lg lw x y w h s) (if s (glgui:draw-box x y w h Grey))
       (glgui:draw-text-left (+ x 5) y (- w 10) h str ascii_18.fnt Black)))
     (list "Ear" "Hand" "Foot"))
   Black field_gradient Black)
Clone this wiki locally