Module Geyser.Button
Represents a clickable button.
Can be a single clickable action or a two state button
which alternates between the two states when clicked.
See also: Mudlet Manual
Info:
- Author: demonnic
Functions
Geyser.Button:disableTwoState () | Disables two state functionality and resets the button state to 'up' if necessary |
Geyser.Button:enableTwoState () | Enables two state functionality for the button |
Geyser.Button:new (cons, container) | Creates a new button and returns it |
Geyser.Button:press () | Handles clicking the button. |
Geyser.Button:setClickCommand (command) | Sets the command to use when the button is clicked. |
Geyser.Button:setClickFunction (clickFunction) | Sets the function to be run when the button is clicked. |
Geyser.Button:setColor (color) | Sets the color to use for the button. |
Geyser.Button:setDownColor (color) | Sets the color to use when the button is in its 'down' state |
Geyser.Button:setDownCommand (command) | Stores the command to send when clicking the button in its 'down' state |
Geyser.Button:setDownFunction (downFunction) | Stores the function to run when clicking the button in its 'down' state. |
Geyser.Button:setDownMsg (msg) | Set the msg displayed on the button when in the 'down' state |
Geyser.Button:setDownStyle (style) | Sets the style to use when the button is in its 'down' state |
Geyser.Button:setMsg (msg) | Set the msg displayed on the button. |
Geyser.Button:setState (state) | Sets the state of the button to "up" or "down" and performs all accompanying visual transformations. |
Geyser.Button:setStyle (style) | Sets the style to use for the button. |
Tables
Geyser.Button | A clickable button. |
Functions
- Geyser.Button:disableTwoState ()
- Disables two state functionality and resets the button state to 'up' if necessary
- Geyser.Button:enableTwoState ()
- Enables two state functionality for the button
- Geyser.Button:new (cons, container)
-
Creates a new button and returns it
Parameters:
- cons table of constraints which define the button
- container the container to place the button into
- Geyser.Button:press ()
- Handles clicking the button. If the button is twoState, also handles switching the button's state
- Geyser.Button:setClickCommand (command)
-
Sets the command to use when the button is clicked. If a two state button, will be used for the 'up' state.
Parameters:
- command the command to send when the button is clicked. Will be treated as an alias.
- Geyser.Button:setClickFunction (clickFunction)
-
Sets the function to be run when the button is clicked. If a two state button, will be used for the 'up' state.
Parameters:
- clickFunction the function to run when the button is clicked.
- Geyser.Button:setColor (color)
-
Sets the color to use for the button. If a two state button, will be used for the 'up' state
Parameters:
- color the color to use
- Geyser.Button:setDownColor (color)
-
Sets the color to use when the button is in its 'down' state
Parameters:
- color the color to use.
- Geyser.Button:setDownCommand (command)
-
Stores the command to send when clicking the button in its 'down' state
Parameters:
- command the command to send. Will be run as though it is an alias.
- Geyser.Button:setDownFunction (downFunction)
-
Stores the function to run when clicking the button in its 'down' state. Supercedes downCommand
Parameters:
- downFunction The function to run when the button is clicked in its 'down' state. Should be a lua function or valid lua code as a string.
- Geyser.Button:setDownMsg (msg)
-
Set the msg displayed on the button when in the 'down' state
Parameters:
- msg the msg to display.
- Geyser.Button:setDownStyle (style)
-
Sets the style to use when the button is in its 'down' state
Parameters:
- style the stylesheet to use
- Geyser.Button:setMsg (msg)
-
Set the msg displayed on the button. If a two state button, will be used for the 'up' state
Parameters:
- msg the msg to display.
- Geyser.Button:setState (state)
-
Sets the state of the button to "up" or "down" and performs all accompanying visual transformations.
Does not simulate the actual click, see Geyser.Button:press for that
Parameters:
- state the state to set the button to. One of "up" or "down"
See also:
- Geyser.Button:setStyle (style)
-
Sets the style to use for the button. If a two state button, will be used for the 'up' state
Parameters:
- style the stylesheet to use
Tables
- Geyser.Button
-
A clickable button.
Fields:
- name The name of the button.
- height The height of the button in pixels.
- width The height of the button in pixels.
- color The color to make the button. If a two state button, will be used for the 'up' state. Superceded by 'style' which is valid and optional stylesheet to use for the button. If a two state button, will be used for the 'up' state.
- downColor The color to make the button while it is in the 'down' state. Superceded by 'downStyle' which is valid and optional stylesheet to use for the button while it is in the 'down' state.
- msg The text to put on the button. If a two state button, will be used for the 'up' state.
- downMsg The text to put on the button in the 'down' state.
- tooltip The text to show when the button is hovered over. For two state buttons will be used for the 'up' tooltip
- downTooltip The text to show when the button is hovered over while in the 'down' state.
- downCommand The command to send when the two state button is clicked while in the 'down' state. 'downFunction' is also valid and optional function to run when the two state button is clicked while in the 'down' state.
- clickCommand The command to send when the button is clicked. For two state buttons, used when clicking in the 'up' state. Will be skipped if 'clickFunction' is defined. 'clickFunction' is also valid and optional function to run when button clicked. For two state buttons, used when clicking in the 'up' state. If defined takes precedence over clickCommand.
- twoState If true, the button will be treated as a two state button, with 'up' and 'down' states.
- state 'up' or 'down' depending on button state for two state buttons. Will always be 'up' if a single state button.
- toolTipDuration The amount of time for the tooltip to show. Used for both 'up' and 'down' states.