Button Element btn
btn(id, r, action)
id
(optional): element IDr
(required): the rectangle where the button will be displayed, type isRect
.action
(optional): the click behavior of the button, see datatype for possible values
After an element is defined, its id
attribute, in addition to the Rect
variable representing the drawing range of the element, also has the following attributes:
id.pressing
: whether the button is being pressed,1
if pressed,0
otherwiseid.last
: the last time the button was pressed. If it has never been pressed, the value is-1
.id.count
: the number of times the button has been pressed