CorsixTH Lua Documentation

UIDropdown Class

Dropdown "window" used for selection of one item from a list.

Declared on: line 22 of Lua/dialogs/resizables/dropdown.lua.
Inheritance: UIDropdown » UIResizable » Window

Method Index

Member Index

(*) only used in superclass methods
function UIDropdown:UIDropdown(ui, parent_window, parent_button, items, callback, colour, scrollbar_colour, disabled_colour)

Constructor for the dropdown "window"

Parameters:

NameTypeDescription
ui UI The ui the window is created in
parent_window Window The window that this dropdown will be attached to
parent_button Button The button in the parent_window that this dropdown will be positioned under
items table A list of items for the list to display, where each item is a table with at least the field text, and optionally fields font and/or tooltip, which is a table containing text, x and y positions.
callback function A function to be called when an item is selected. It is called with two parameters: The parent window and the index of the selected item
colour table Colour of the dropdown's list items, in the form of {red = ..., green = ..., blue = ...}. Optional if parent_window is a UIResizable
scrollbar_colour table Colour of the scrollbar's 'thumb', and button hover in the form of {red = ..., green = ..., blue = ...}. Optional if parent_window is a UIResizable
disabled_colour table Colour of the disabled items in the form of {red = ..., green = ..., blue = ...}. Optional.

Declared on: line 28 of Lua/dialogs/resizables/dropdown.lua.

function UIDropdown:beginDrag(x, y)

Parameters:

NameTypeDescription
x ? ?
y ? ?

Overrides: Window:beginDrag.
Declared on: line 139 of Lua/dialogs/resizables/dropdown.lua.

function UIDropdown:onMouseDown(button, x, y)

Let dropdown close when clicked outside of

Parameters:

NameTypeDescription
button button mouseclick
x coord x coordinate
y coord y coordinate

Overrides: UIResizable:onMouseDown.
Declared on: line 146 of Lua/dialogs/resizables/dropdown.lua.

function UIDropdown:onMouseMove(x, y, dx, dy)

Parameters:

NameTypeDescription
x ? ?
y ? ?
dx ? ?
dy ? ?

Overrides: Window:onMouseMove.
Declared on: line 189 of Lua/dialogs/resizables/dropdown.lua.

function UIDropdown:onMouseWheel(x, y)

Allow the dropdown to scroll through mousewheel input

Parameters:

NameTypeDescription
x int UNUSED, 1 on right scroll, -1 on left scroll
y int 1 on up scroll, -1 on down scroll

Overrides: Window:onMouseWheel.
Declared on: line 160 of Lua/dialogs/resizables/dropdown.lua.

function UIDropdown:selectItem(number)

Parameters:

NameTypeDescription
number ? ?

Declared on: line 129 of Lua/dialogs/resizables/dropdown.lua.