Difference between revisions of "Lua:Class:ComboBox"
Jump to navigation
Jump to search
Bronzdragon (talk | contribs) (Page creation.) |
Bronzdragon (talk | contribs) (Added an example) |
||
Line 9: | Line 9: | ||
Canvas: Canvas - The canvas object used to render on the object | Canvas: Canvas - The canvas object used to render on the object | ||
− | === | + | ===Methods=== |
clear() | clear() | ||
getItems() | getItems() | ||
Line 16: | Line 16: | ||
setItemIndex(integer) | setItemIndex(integer) | ||
getCanvas() | getCanvas() | ||
+ | |||
+ | ===Example=== | ||
+ | function print_item(sender) | ||
+ | print(sender.ItemIndex) | ||
+ | end<br /> | ||
+ | form = createForm()<br /> | ||
+ | example_box = createComboBox(example_form) | ||
+ | example_box.items.add("Apple") | ||
+ | example_box.items.add("Orange") | ||
+ | example_box.items.add("Banana")<br /> | ||
+ | example_box.onChange = print_item |
Revision as of 17:10, 30 January 2014
ComboBox Class: (Inheritance: WinControl->Control->Component->Object)
createComboBox(owner): Creates a ComboBox class object which belongs to the given owner. Owner can be any object inherited from WinControl
properties
Items: Strings - Strings derived object containings all the items in the list ItemIndex: integer - Get selected index. -1 is nothing selected Canvas: Canvas - The canvas object used to render on the object
Methods
clear() getItems() setItems() getItemIndex() setItemIndex(integer) getCanvas()
Example
function print_item(sender) print(sender.ItemIndex) end
form = createForm()
example_box = createComboBox(example_form) example_box.items.add("Apple") example_box.items.add("Orange") example_box.items.add("Banana")
example_box.onChange = print_item