Button
April 10, 2017 ยท View on GitHub
Overview
Buttons are simple controls that can be pressed.
<button text="press me!" ontap="foobar" />
actions.foobar = function ()
print("you pressed a button!");
end
Properties
id
Set the ID for this control so that it can be updated later. See layout library.
<button id="my_btn" />
visibility
Set the visibility state using visible or invisible or gone.
<button visibility="gone" />
text
Set the text to be shown in the button.
<button text="hello world" />
textalign
Set horizontal text alignment using left or center or right.
<button text="foo" textalign="right" />
icon
Set a standard control icon. See icons list of available icons.
<button icon="select" />
image
Set a custom image to use. Should be an absolute path or relative to the layout file.
<button image="img.png" />
scale
Sets the scaling used for images. Values: icon (default), fill, fit, or native.
<button image="img.png" scale="fit" />
Styling
See the styling page for more details.
Events
ontap
Occurs when the button is tapped.
<button text="foo" ontap="foo_tapped" />
actions.foo_tapped = function ()
...
end
onhold
Occurs when the button is held down.
<button text="bar" onhold="bar_held" />
actions.bar_held = function ()
...
end
ondown
Occurs when the button is pressed.
<button text="hello" ondown="hello_down" />
actions.hello_down = function ()
...
end
onup
Occurs when the button released.
<button text="world" onup="world_up" />
actions.world_up = function ()
...
end