Skip to content

Dropdown

Robert Jelic edited this page Apr 2, 2022 · 5 revisions

Dropdowns are objects which looks like a button, but as soon as you click on them, they will open a dropdown where you can choose a value. But first you will have to add possible values

Here is a example of how to create a standard dropdown:

local mainFrame = NyoUI.createFrame("myFirstFrame"):show()
local aDropdown = mainFrame:addDropdown("myFirstDropdown"):show()

This will create a default dropdown with the size 5 width and 1 height 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 10. The default horizontal text align is "center"

Here are all possible functions available for dropdowns. Remember dropdown inherit from object:

addItem

Adds a item to the list

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)

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.
returns: the object

Wiki Navigation

Home
Clone this wiki locally