-
Notifications
You must be signed in to change notification settings - Fork 40
Radio
Radios are objects where you can create endless entrys the user can click on a button and it opens a "list" where the user can choose a entry
Here is a example of how to create a standard radio:
local mainFrame = basalt.createFrame("myFirstFrame"):show()
local aRadio = mainFrame:addRadio("myFirstRadio"):show()
Here are all possible functions available for radios:
Remember radio inherits from object:
Adds a item to the radio
local mainFrame = basalt.createFrame("myFirstFrame"):show()
local aRadio = mainFrame:addRadio("myFirstRadio"):show()
aRadio:addItem("1. Entry",3,4)
aRadio:addItem("2. Entry",3,5,colors.yellow)
aRadio:addItem("3. Entry",3,6,colors.yellow,colors.green)
parameters: string text, number x, number y, number bgcolor, number fgcolor, any ... - (text is the displayed text, bgcolor and fgcolors the colors of background/text and args (...) is something dynamic, you wont see them but if you require some more information per item you can use that)
returns: self
Removes a item from the radio
local mainFrame = basalt.createFrame("myFirstFrame"):show()
local aRadio = mainFrame:addRadio("myFirstRadio"):show()
aRadio:addItem("1. Entry",3,4)
aRadio:addItem("2. Entry",3,5,colors.yellow)
aRadio:addItem("3. Entry",3,6,colors.yellow,colors.green)
aRadio:removeItem(2)
parameters: number index
returns: self
Edits a item on the radio
local mainFrame = basalt.createFrame("myFirstFrame"):show()
local aRadio = mainFrame:addRadio("myFirstRadio"):show()
aRadio:addItem("1. Entry",3,4)
aRadio:addItem("2. Entry",3,5,colors.yellow)
aRadio:addItem("3. Entry",3,6,colors.yellow,colors.green)
aRadio:editItem(3,"3. Edited Entry",3,6,colors.yellow,colors.green)
parameters: number index, string text, number x, number y, number bgcolor, number fgcolor, any ...
returns: self
Makes the radio scrollable
local mainFrame = basalt.createFrame("myFirstFrame"):show()
local aRadio = mainFrame:addRadio("myFirstRadio"):show()
aRadio:addItem("1. Entry",3,4)
aRadio:addItem("2. Entry",3,5,colors.yellow)
aRadio:addItem("3. Entry",3,6,colors.yellow,colors.green)
aRadio:setScrollable(true)
parameters: boolean isScrollable
returns: self
selects a item in the radio (same as a player would click on a item)
local mainFrame = basalt.createFrame("myFirstFrame"):show()
local aRadio = mainFrame:addRadio("myFirstRadio"):show()
aRadio:addItem("1. Entry",3,4)
aRadio:addItem("2. Entry",3,5,colors.yellow)
aRadio:addItem("3. Entry",3,6,colors.yellow,colors.green)
aRadio:selectItem(1)
parameters: number index
returns: self
clears the entire list (radio)
local mainFrame = basalt.createFrame("myFirstFrame"):show()
local aRadio = mainFrame:addRadio("myFirstRadio"):show()
aRadio:addItem("1. Entry",3,4)
aRadio:addItem("2. Entry",3,5,colors.yellow)
aRadio:addItem("3. Entry",3,6,colors.yellow,colors.green)
aRadio:clear()
parameters: -
returns: self
returns the item index of the currently selected item
local mainFrame = basalt.createFrame("myFirstFrame"):show()
local aRadio = mainFrame:addRadio("myFirstRadio"):show()
aRadio:addItem("1. Entry",3,4)
aRadio:addItem("2. Entry",3,5,colors.yellow)
aRadio:addItem("3. Entry",3,6,colors.yellow,colors.green)
aRadio:getItemIndex()
parameters: -
returns: number index
Sets the background of the item which is currently selected
local mainFrame = basalt.createFrame("myFirstFrame"):show()
local aRadio = mainFrame:addRadio("myFirstRadio"):show()
aRadio:addItem("1. Entry",3,4)
aRadio:addItem("2. Entry",3,5,colors.yellow)
aRadio:addItem("3. Entry",3,6,colors.yellow,colors.green)
aRadio:setSelectedItem(colors.green, colors.blue)
parameters: number bgcolor, number fgcolor, boolean isActive (isActive means if different colors for selected item should be used)
returns: self
Thanks for checking out our wiki, join our discord for more help: discord.gg/yM7kndJdJJ