# Class: ComboBox

### LuxModule: gui

A ComboBox combines multiple strings that can be selected in a small rectangle. The current state is very simple but is capable of mimic the basics of a normal ComboBox.

## Hierarchy

    o-+ Component
      o-+ Container
        o-+ ComboBox

## Methods:

### Method overview:

- addItem
- clearItems
- getItems
- getSelected
- new
- onSelected
- removeItem
- select
- setItems

new (table class, int x,y,w,h,[Skin2D skin])
  returns: (ComboBox)
  creates a combobox at the given coordinates with the given skin.
addItem (ComboBox, string caption, [string cmd,[icon, iconskinselection] ])
  returns: (function add)
  adds an item to the combobox. It returns a function that can be called again:

       mycombobox:addItem("Hello")("World") -- adds hello and world

clearItems (ComboBox)
  returns: ()
  removes all items from the list
getItems (ComboBox)
  returns: (table)
  returns a table with all items (copy). Each tableelement is a table containing following keys:
  1. caption
  2. command
  3. icon
  4. iconname
  The values are all optional except for the caption.
getSelected (ComboBox)
  returns: ([int index, string caption, string command])
  returns information on the currently selected item.
onSelected (ComboBox,int index, string caption, string command)
  returns: ()
  this function can be overloaded without calling this function. It is called each time the user selects an item - which does not have to be different from the previously selected item.
removeItem (ComboBox, int id)
  returns: ()
  Removes an item from the list. The id refers to the index of the item in the list.
select (ComboBox, string/int something, [boolean iscommand])
  returns: (int selected)
  selects the specified item by its name, number or commandstring
setItems (ComboBox,table)
  returns: ()
  sets (and clears previous) all items. Table must be built like the one retrieved by getItems.

## Inherited Methods:

### From Container

add, components, delete, deleteChilds, doLayout, getComponentAt, getRootContainer, invalidate, isChildOf, isRootContainer, mouseEvent, moveZ, new, onDisplayChange, onVisibilityChange, removeChildren, removeComponent, setBounds, toString, validate

### From Component

acceptSkinBounds, addKeyListener, addMouseListener, addTooltipListener, clipinsets, colors, contains, createVisibles, delete, deleteVisibles, fadeTo, focus, focuscolors, getBottom, getBounds, getClipRect, getFocusComponentAt, getFocusElement, getFocusIndex, getHeight, getLocation, getMinSize, getMouseLock, getParent, getRight, getSize, getSkin, getTooltip, getWidth, getX, getY, hasFocus, hideVisibles, index, invalidate, isClipped, isDisplayedFlag, isFocusable, isMouseLocker, isVisible, isVisibleFlag, keyEvent, keylisteners, local2world, lockMouse, mouseClicked, mouseEntered, mouseEvent, mouseExited, mouseMoved, mousePressed, mouseReleased, mouseWheeled, mouselisteners, moveToRect, new, newFocusOrder, onDestroy, onDisplayChange, onGainedFocus, onLostFocus, onVisibilityChange, positionUpdate, remove, removeKeyListener, removeMouseListener, removeTooltipListener, setBounds, setClip, setColor, setDefaultUI, setDisabled, setDisplayable, setFont, setLocation, setSize, setSkin, setTooltip, setVisibility, showTooltipInformation, showVisibles, skinnames.defaultskin, skinnames.focusedskin, skinnames.hoveredskin, skinnames.pressedskin, think, toString, transferFocus, transferFocusOnArrows, transferFocusOnTab, unlockMouse, updateSkin, validate, validateFocus, white, world2local, zorderoffset