rocinantealpha

reference / interface

image button

A button in a ui block that shows a picture and is true on the frame it is clicked: if image button badge "stamp" [ ... ]. The text is its name, which a screen reader says and which tells it from the other buttons. It is the picture's own size, down to 64 pixels at most, or the size you give it. A canvas shows as it was last drawn, and a picture that is missing leaves an empty button.

badge = load "sprite.png"stamps = 0ui [  if image button badge "stamp" [ stamps = stamps + 1 ]  label ("stamps: " + stamps)]draw [  background 245  repeat (stamps % 12) [    image badge at (60 + stamps * 8) 200 size 32 32  ]]

How to write it

image button picture text [size number number] [at number number]

Gives true or false.

Related