Class spinbox
A Geyser object to create a spinbox for adjusting a number
Info:
- Copyright: 2023
- License: MIT, see https://raw.githubusercontent.com/demonnic/MDK/main/src/scripts/LICENSE.lua
- Author: Damian Monogue
Methods
spinbox:new(cons, container) | Creates a new spinbox. |
spinbox:setValue(value) | Used to directly set the value of the spinbox. |
spinbox:generateStyles() | (Re)generates the stylesheets for the spinbox Should not need to call but if you change something and it doesn't take effect you can try calling this followed by applyStyles |
spinbox:applyStyles() | Applies updated stylesheets to the components of the spinbox Should not need to call this directly |
spinbox:setActiveButtonColor(color) | sets the color for active buttons on the spinbox |
spinbox:setInactiveButtonColor(color) | sets the color for inactive buttons on the spinbox |
spinbox:setCallBack(func) | Set a callback function for the spinbox to call any time the value of the spinbox is changed the function will be called as func(self.value, self.name) |
Methods
- spinbox:new(cons, container) line 89
-
Creates a new spinbox.
Parameters:
- cons
table
a table containing the options for this spinbox.
option name description default min The minimum value for this spinbox 0 max The maximum value for this spinbox 10 activeButtonColor The color the up/down buttons should be when they are active/able to be used gray inactiveButtonColor The color the up/down buttons should be when they are inactive/unable to be used dimgray integer Boolean value. When true, values must always be integers (no decimal place) true delta The amount to change the spinbox's value when the up or down button is pressed. 1 upArrowLocation The location of the up arrow image. Either a web URL where it can be downloaded, or the location on disk to read it from https://demonnic.github.io/image-assets/uparrow.png downArrowLocation The location of the down arrow image. Either a web URL where it can be downloaded, or the location on disk to read it from https://demonnic.github.io/image-assets/downarrow.png callBack The function to run when the spinbox's value is updated. Is called with parameters (self.name, value, oldValue) nil - container The Geyser container for this spinbox
- cons
table
a table containing the options for this spinbox.
- spinbox:setValue(value) line 270
-
Used to directly set the value of the spinbox.
Parameters:
- value The new value to set Rounds the value to an integer if the spinbox is integer only. Checks if the new value is within the min/max range and clamps it if not. Updates the display label with the new value. Applies any styles that depend on the value.
- spinbox:generateStyles() line 387
- (Re)generates the stylesheets for the spinbox Should not need to call but if you change something and it doesn't take effect you can try calling this followed by applyStyles
- spinbox:applyStyles() line 412
- Applies updated stylesheets to the components of the spinbox Should not need to call this directly
- spinbox:setActiveButtonColor(color) line 430
-
sets the color for active buttons on the spinbox
Parameters:
- color any valid color formatting string, such a "red" or "#880000" or "<128,0,0>" or a table of colors, like {128, 0,0}. See Geyser.Color.parse at https://www.mudlet.org/geyser/files/geyser/GeyserColor.html#Geyser.Color.parse
- spinbox:setInactiveButtonColor(color) line 445
-
sets the color for inactive buttons on the spinbox
Parameters:
- color
any valid color formatting string, such a "
" or "red" or "<128,0,0>" or a table of colors, like {128, 0,0}. See Geyser.Color.parse at https://www.mudlet.org/geyser/files/geyser/GeyserColor.html#Geyser.Color.parse
- color
any valid color formatting string, such a "
- spinbox:setCallBack(func) line 472
-
Set a callback function for the spinbox to call any time the value of the spinbox is changed
the function will be called as func(self.value, self.name)
Parameters:
- func