Button Class
A region of a `Panel` which causes some action when clicked.
Method Index
- enable(enable)
- handleClick(mouse_button)
- makeRepeat()
- makeToggle()
- preservePanel()
- setDisabledSprite(index)
- setDynamicTooltip(callback, x, y)
- setLabel(label, font, align)
- setPosition(x, y)
- setSize(width, height)
- setSound(name)
- setToggleState(state)
- setTooltip(tooltip, x, y)
- toggle()
Member Index
- b
- enabled
- is_repeat
- is_toggle
- on_click
- on_click_self
- on_rightclick
- panel_for_sprite
- panel_lowered_active
- panel_lowered_normal
- r
- sound
- sprite_index_active
- sprite_index_disabled
- sprite_index_normal
- toggled
- tooltip
- ui
- x
- y
function Button:Button()
Declared on: line 515 of Lua/window.lua.
function Button:enable(enable)
Parameters:
Name | Type | Description |
---|---|---|
enable | ? | ? |
Declared on: line 543 of Lua/window.lua.
function Button:handleClick(mouse_button)
this or another button). However for repeat buttons, it is called once on MouseDown and, after
a short delay, repeatedly.
Parameters:
Name | Type | Description |
---|---|---|
mouse_button | string | either "left" or "right" |
Declared on: line 630 of Lua/window.lua.
function Button:makeRepeat()
Declared on: line 568 of Lua/window.lua.
function Button:makeToggle()
Declared on: line 561 of Lua/window.lua.
function Button:preservePanel()
Declared on: line 593 of Lua/window.lua.
function Button:setDisabledSprite(index)
Parameters:
Name | Type | Description |
---|---|---|
index | ? | ? |
Declared on: line 538 of Lua/window.lua.
function Button:setDynamicTooltip(callback, x, y)
Parameters:
Name | Type | Description |
---|---|---|
callback | ? | ? |
x | ? | ? |
y | ? | ? |
Declared on: line 621 of Lua/window.lua.
function Button:setLabel(label, font, align)
Convenience function to allow setLabel to be called on a button, not only its panel.
see Panel:setLabel
Parameters:
Name | Type | Description |
---|---|---|
label | ? | ? |
font | ? | ? |
align | ? | ? |
Declared on: line 676 of Lua/window.lua.
function Button:setPosition(x, y)
Parameters:
Name | Type | Description |
---|---|---|
x | ? | ? |
y | ? | ? |
Declared on: line 654 of Lua/window.lua.
function Button:setSize(width, height)
Parameters:
Name | Type | Description |
---|---|---|
width | ? | ? |
height | ? | ? |
Declared on: line 666 of Lua/window.lua.
function Button:setSound(name)
Parameters:
Name | Type | Description |
---|---|---|
name | ? | ? |
Declared on: line 600 of Lua/window.lua.
function Button:setToggleState(state)
Parameters:
Name | Type | Description |
---|---|---|
state | ? | ? |
Declared on: line 586 of Lua/window.lua.
function Button:setTooltip(tooltip, x, y)
Specify a tooltip to be displayed when hovering this button.
x and y are optional position of bottom left of the tooltip.
If not specified, will default to top center of button.
Parameters:
Name | Type | Description |
---|---|---|
tooltip | ? | ? |
x | ? | ? |
y | ? | ? |
Declared on: line 609 of Lua/window.lua.
function Button:toggle()
Declared on: line 575 of Lua/window.lua.