-
Notifications
You must be signed in to change notification settings - Fork 15
(API) Multichoice
The multichoice object is a dropdown list.
function love.load()
loveframes = require("loveframes")
local multichoice = loveframes.Create("multichoice")
multichoice:SetPos(5, 5)
for i=1, 10 do
multichoice:AddChoice(i)
end
end
function love.update(dt)
loveframes.update(dt)
end
function love.draw()
loveframes.draw()
end
function love.mousepressed(x, y, button)
loveframes.mousepressed(x, y, button)
end
function love.mousereleased(x, y, button)
loveframes.mousereleased(x, y, button)
end
Called when a choice is selected
Arguments passed: self [object], choice [string]
local multichoice = loveframes.Create("multichoice")
multichoice.OnChoiceSelected = function(object, choice)
print(choice .. " was selected.")
end
Adds a choice to the object
object:SetText(text[string])
Sets the current choice of the object
Note: Does not call the OnChoiceSelected callback.
object:SetChoice(choice[string])
Sets the current choice of the object
Note: This method is used by the object internally. You should not use it unless you know what you are doing.
object:SelectChoice(choice[string])
Sets the current choice of the object
object:SetListHeight(height[number])
Sets the object's padding
object:SetPadding(padding[number])
Sets the object's spacing
object:SetSpacing(spacing[number])
Gets the object's current choice
Returns 1 value: choice [string]
local choice = object:GetChoice()
Gets the object's current choice
Returns 1 value: value [string]
Note: This is the same as GetChoice()
local value = object:GetValue()
Gets the object's current choice index
Returns 1 value: choice [number]
local choice = object:GetChoiceIndex()
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 that the object's scroll buttons will scroll the object's list items by
object:SetButtonScrollAmount(scrollamount[number])
Sets the amount that the object's scroll buttons will scroll the object's list items by
Returns 1 value: scroll amount [number]
local scrollamount = object:GetButtonScrollAmount()
Sets the amount that the mouse wheel will scroll the object's list items by
object:SetMouseWheelScrollAmount(scrollamount[number])
Gets the mouse wheel's scroll amount
Returns 1 value: scroll amount [number]
local scrollamount = object:GetMouseWheelScrollAmount()
Sets whether or not the object should use delta time when caclulating how many pixels it's scrollbar needs to move
object:SetDTScrolling(dtscrolling[boolean])
Gets whether or not the object should use delta time when caclulating how many pixels it's scrollbar needs to move
Returns 1 value: dtscrolling [boolean]
local dtscrolling = object:GetDTScrolling()
Sorts the object's choices
Note: If no function is specified then the object will use it's default sorting function
local func = function(a, b) a < b end
object:Sort(func[function])
Sets the object's default soring function
local func = function(a, b) a < b end
object:SetSortFunction(func[function])
Gets the object's default soring function
local func = object:GetSortFunction()
Sets the object's default soring function
local func = function(a, b) a < b end
object:SetSortFunction(func[function])
Gets the object's default soring function
local func = object:GetSortFunction()
Removes a choice from the object's list of choices
object:RemoveChoice(choice[string])
Removes all choices from the object's list of choices
object:Clear()
Enables or disables the object
object:SetEnabled(enabled[bool])
Gets whether or not the object is enabled
Returns 1 value: enabled [bool]
local enabled = object:GetEnabled()