Skip to content
Dustin edited this page May 31, 2016 · 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. If there is still not enough space a scrollbar will be used within the list that appears.

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

Additional Attributes

Attribute Default Value Description
maxitems 5 Max number of items to make visible at once
current -1 Current list item selected, -1 selects no item
bidir False If true, expands dropdown list both up and down if necessary
scrollcolor DimGray The color of the scrollbar.
scrollw 5. The width of the scrollbar.
scrollrounded #f If set to true, the scrollbar is drawn as a rounded box.

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