Skip to content

glgui bubbleselector

Dustin edited this page Oct 8, 2015 · 1 revision

glgui-bubbleselector creates a widget for selecting an image from among a horizontal row of images. As the user drags the cursor (or their finger) from left to right a bubble effect occurs as each image grows when the cursor is near it. On release, only the closest image will be increased in size. The value is set to the index of this image and a callback can be triggered.

Parameter Description
g The Graphical User Interface (GUI) belonging to this widget
x The lower left corner along the x-axis in pixels
y The lower left corner along the y-axis in pixels
w The width of the element in pixels
h The height of the element in pixels
images The list of images to select from
scale The percent of size to reduce each image to when not under the cursor

Example

Example 1: Create a row of icons of selectable symptom images that a pregnant woman may have. Shrink each image to 40% when it is not selected.

(set! symptoms (glgui-bubbleselector gui 0 0 480 260 (list headache.img visual.img chest.img dyspnoea.img abdominal.img) 0.4)

Attributes

Besides the parameters set in the procedure, the widget has the following attributes that can be set using glgui-widget-set! and retrieved using glgui-widget-get:

Attribute Default Value Description
value False Set by the widget to be the index of the selected image
callback False If set to a procedure, this procedure will be called when an image is selected (on EVENT_BUTTON1UP)
color White If the images in the list have just one channel, this is the color that will be used.
hidden False If true, the widget is not displayed.

Example

Example 2: Setup a callback so that when an image is selected the value (its index) is logged.

(glgui-widget-set! gui symptoms 'callback 
   (lambda (g wgt type mx my)
      (log-status (glgui-widget-get gui symptoms 'value))))
Clone this wiki locally