glgui button arrow - part-cw/lambdanative GitHub Wiki
(glgui-button-arrow g x y w h l img callback)
glgui-button-arrow creates a clickable arrow button widget (with a callback procedure). This widget requires an image texture.
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 |
l | Specifies whether the arrow is pointing left. If true it points left, otherwise the arrow points right. |
img | The button image texture |
callback | The callback procedure executed upon being clicked |
Example
Example 1: Create a left arrow button that when clicked plays an audio file "AHOOGA". In addtion, this widget changes color from red to white everytime it is clicked. This widget is diplayed with image texture pushme.img and is specified with x=0, y=10, width= 60, height= 30, left= #f and belongs to gui g. Image file pushme.png is required in application's textures folder.
(audiofile-init)
(set! ahooga (audiofile-load "ahooga"))
(define (button-callback g w t x y)
(let ((oldcolor (glgui-widget-get g w 'color)))
(if ahooga (audiofile-play ahooga))
(glgui-widget-set! g w 'color (if (= oldcolor White) Red White))
(set! g (make-glgui))
(glgui-button g 0 10 60 30 #f pushme.img button-callback)