Updated Radio (markdown)

Robert Jelic
2022-04-02 15:03:45 +02:00
parent bac72c9784
commit 4e8b3b4c33

@@ -1 +1,48 @@
WIP
Radios are objects, where the user can choose between different items.<br>
Here is a example of how to create a standard radio:
````lua
local mainFrame = CreateFrame("myFirstFrame"):show()
local aRadio = mainFrame:addRadio("myFirstRadio"):show()
````
This will create a default radio on position 1 1 (relative to its parent frame), the default background is colors.lightBlue, the default text color is colors.black and the default zIndex is 5.
Here are all possible functions available for radios. Remember radio inherit from [object](https://github.com/NoryiE/NyoUI/wiki/Object):
## addItem
Adds a item to the radio
````lua
local mainFrame = NyoUI.createFrame("myFirstFrame"):show()
local aRadio = mainFrame:addRadio("myFirstRadio"):show()
aRadio:addItem("1. Entry")
aRadio:addItem("2. Entry",5,1,colors.yellow)
aRadio:addItem("3. Entry",5,4,colors.yellow,colors.green)
````
**args:** text, x, y bgcolor, fgcolor, ..., text is the displayed text, x and y are the position, where you want the item to be created, 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.<br>
**returns:** the object<br>
## removeItem
Removes a item to the radio
````lua
local mainFrame = NyoUI.createFrame("myFirstFrame"):show()
local aRadio = mainFrame:addRadio("myFirstRadio"):show()
aRadio:addItem("1. Entry")
aRadio:addItem("2. Entry",colors.yellow)
aRadio:addItem("3. Entry",colors.yellow,colors.green)
aRadio:removeItem(2)
````
**args:** item table (you can get with :getValue()) OR item index<br>
**returns:** the object<br>
## setSymbol
changes the selected symbol
````lua
local mainFrame = CreateFrame("myFirstFrame"):show()
local aInput = mainFrame:addInput("myFirstInput"):setInputType("password"):show()
````
**args:** char<br>
**returns:** the object<br>