-
Couldn't load subscription status.
- Fork 19
(API) Slider
The slider object has a button that can be set to slide vertically or horizontally. The object also has a value that can be changed when it moves and a callback for when it's value changes.
local frame = loveframes.Create("frame")
frame:SetName("Slider")
frame:SetSize(300, 275)
frame:CenterWithinArea(unpack(demo.centerarea))
local slider1 = loveframes.Create("slider", frame)
slider1:SetPos(5, 30)
slider1:SetWidth(290)
slider1:SetMinMax(0, 100)
local slider2 = loveframes.Create("slider", frame)
slider2:SetPos(5, 60)
slider2:SetHeight(200)
slider2:SetMinMax(0, 100)
slider2:SetButtonSize(20, 10)
slider2:SetSlideType("vertical")
slider2.Update = function(object, dt)
object:CenterX()
endCalled every time the object's value changes
Arguments passed: self [object]
local slider = loveframes.Create("slider")
slider.OnValueChanged = function(object)
print("The slider's value changed to : " ..object:GetValue())
endCalled every time the slider button is released from being dragged
Arguments passed: self [object]
local slider = loveframes.Create("slider")
slider.OnRelease = function(object)
print("The slider button has been released.")
endSets the value of the object
object:SetValue(value[number])Gets the value of the object
Returns 1 value: value [number]
local value = object:GetValue()Sets the object's maximum value
object:SetMax(max[number])Gets the object's maximum value
Returns 1 value: max [number]
local max = object:GetMax()Sets the object's minimum value
object:SetMin(min[number])Gets the object's minimum value
Returns 1 value: min [number]
local min = object:GetMin()Sets the object's minimum and maximum values
object:SetMinMax(min[number], max[number])Gets the object's minimum and maximum values
Returns 2 values: minimum [number], maximum [number]
local min, max = object:GetMinMax(min[number], max[number])Sets the object's text
object:SetText(text[string])Gets the object's text
Returns 1 value: text [string]
local text = object:GetText()Sets the amount of decimals the object's value should have.
object:SetDecimals(decimals[number])Sets size of the object's slider button.
Returns 2 values: width [number], height [number]
local width, height = object:GetButtonSize()Sets the slide type of the object. Acceptable arguments are "vertical" or "horizontal".
object:SetSlideType(slidetype[string])Sets whether or not the object should be scrollable via the mouse wheel
object:SetScrollable(scrollable[boolean])Gets whether or not the object should be scrollable via the mouse wheel
Returns 1 value: scrollable [boolean]
local scrollable = object:GetScrollable()Sets the amount to increase the object's value by when scrolling with the mouse wheel
object:SetScrollIncrease(increase[number])Gets the amount to increase the object's value by when scrolling with the mouse wheel
Returns 1 value: increase [number]
local increase = object:GetScrollIncrease()Sets the amount to decrease the object's value by when scrolling with the mouse wheel
object:SetScrollDecrease(decrease[number])Gets the amount to decrease the object's value by when scrolling with the mouse wheel
Returns 1 value: increase [number]
local decrease = object:GetScrollDecrease()