Updated Dropdown (markdown)
87
Dropdown.md
87
Dropdown.md
@@ -22,4 +22,89 @@ aDropDown:addItem("2. Entry",colors.yellow)
|
||||
aDropDown:addItem("3. Entry",colors.yellow,colors.green)
|
||||
````
|
||||
**args:** text, bgcolor, fgcolor, ..., 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.<br>
|
||||
**returns:** the object<br>
|
||||
**returns:** the object<br>
|
||||
|
||||
## removeItem
|
||||
Removes a item to the list
|
||||
|
||||
````lua
|
||||
local mainFrame = NyoUI.createFrame("myFirstFrame"):show()
|
||||
local aDropdown = mainFrame:addDropdown("myFirstDropdown"):show()
|
||||
aDropDown:addItem("1. Entry")
|
||||
aDropDown:addItem("2. Entry",colors.yellow)
|
||||
aDropDown:addItem("3. Entry",colors.yellow,colors.green)
|
||||
aDropDown:removeItem(2)
|
||||
````
|
||||
**args:** item table (you can get with :getValue()) OR item index<br>
|
||||
**returns:** the object<br>
|
||||
|
||||
## setActiveItemBackground
|
||||
Sets the background of the item if its currently selected
|
||||
|
||||
````lua
|
||||
local mainFrame = NyoUI.createFrame("myFirstFrame"):show()
|
||||
local aDropdown = mainFrame:addDropdown("myFirstDropdown"):show()
|
||||
aDropDown:addItem("1. Entry")
|
||||
aDropDown:addItem("2. Entry",colors.yellow)
|
||||
aDropDown:addItem("3. Entry",colors.yellow,colors.green)
|
||||
aDropDown:setActiveItemBackground(colors.green)
|
||||
````
|
||||
**args:** any color<br>
|
||||
**returns:** the object<br>
|
||||
|
||||
## setActiveItemForeground
|
||||
Sets the foreground of the item if its currently selected
|
||||
|
||||
````lua
|
||||
local mainFrame = NyoUI.createFrame("myFirstFrame"):show()
|
||||
local aDropdown = mainFrame:addDropdown("myFirstDropdown"):show()
|
||||
aDropDown:addItem("1. Entry")
|
||||
aDropDown:addItem("2. Entry",colors.yellow)
|
||||
aDropDown:addItem("3. Entry",colors.yellow,colors.green)
|
||||
aDropDown:setActiveItemForeground(colors.red)
|
||||
````
|
||||
**args:** any color<br>
|
||||
**returns:** the object<br>
|
||||
|
||||
## setItemColors
|
||||
Sets item background colors in the list
|
||||
you can set as many colors as you want, it will set one color per line, if it got to the last color it will go back to the first color
|
||||
|
||||
````lua
|
||||
local mainFrame = NyoUI.createFrame("myFirstFrame"):show()
|
||||
local aDropdown = mainFrame:addDropdown("myFirstDropdown"):show()
|
||||
aDropDown:addItem("1. Entry")
|
||||
aDropDown:addItem("2. Entry",colors.yellow)
|
||||
aDropDown:addItem("3. Entry",colors.yellow,colors.green)
|
||||
aDropDown:setItemColors(colors.red,colors.blue)
|
||||
````
|
||||
**args:** any color - multiple colors possible<br>
|
||||
**returns:** the object<br>
|
||||
|
||||
## setItemTextColors
|
||||
Sets item text colors in the list
|
||||
you can set as many colors as you want, it will set one color per line, if it got to the last color it will go back to the first color
|
||||
|
||||
````lua
|
||||
local mainFrame = NyoUI.createFrame("myFirstFrame"):show()
|
||||
local aDropdown = mainFrame:addDropdown("myFirstDropdown"):show()
|
||||
aDropDown:addItem("1. Entry")
|
||||
aDropDown:addItem("2. Entry",colors.yellow)
|
||||
aDropDown:addItem("3. Entry",colors.yellow,colors.green)
|
||||
aDropDown:setItemTextColors(colors.blue,colors.red)
|
||||
````
|
||||
**args:** any color - multiple colors possible<br>
|
||||
**returns:** the object<br>
|
||||
|
||||
# Examples
|
||||
Get the selected item informations:
|
||||
````lua
|
||||
local mainFrame = NyoUI.createFrame("myFirstFrame"):show()
|
||||
local aDropdown = mainFrame:addDropdown("myFirstDropdown"):show()
|
||||
aDropDown:addItem("1. Entry")
|
||||
aDropDown:addItem("2. Entry",colors.yellow)
|
||||
aDropDown:addItem("3. Entry",colors.yellow,colors.green)
|
||||
aDropDown:onChange(function(self)
|
||||
NyoUI.debug(self:getValue().text,self:getValue().bgcolor,self:getValue().fgcolor,self:getValue().vars)
|
||||
end)
|
||||
````
|
||||
Reference in New Issue
Block a user