Class zebkit.ui.Combo
extends <zebkit.ui.Panel>
<zebkit.ui>

Combo box UI component class. Combo uses a list component to show in drop down window. You can use any available list component implementation:

       // use simple list as combo box drop down window
       var combo = new zebkit.ui.Combo(new zebkit.ui.List([
           "Item 1",
           "Item 2",
           "Item 3"
       ]));


       // use component list as combo box drop down window
       var combo = new zebkit.ui.Combo(new zebkit.ui.CompList([
           "Item 1",
           "Item 2",
           "Item 3"
       ]));


       // let combo box decides which list component has to be used
       var combo = new zebkit.ui.Combo([
           "Item 1",
           "Item 2",
           "Item 3"
       ]);
Constructor:
zebkit.ui.Combo (data)

Parameters:



public void fired (src)
public <Object> getValue ( )
public void hidePad ( )
public <Boolean> isPadShown ( )
public void keyPressed (e)
public void keyTyped (e)
public void pointerPressed (e)
public void select (i)
protected void selected (src, data)
public void setEditable (b)
public void setList (l)
public void setMaxPadHeight (h)
public void setSelectView (c)
public void setValue (v)
public void showPad ( )


Inherited methods:
$setConstraints(c)    add(constr, d)    byConstraints([p], c)    byPath(path, [cb])    calcPreferredSize(target)    doLayout( )    fire(event, [path], [params])    focused( )    getBottom( )    getCanvas( )    getComponentAt(x, y)    getHorPadding( )    getLeft( )    getPreferredSize( )    getRight( )    getTop( )    getVerPadding( )    hasFocus( )    indexOf(c)    insert(i, constr, d)    invalidate( )    invalidateLayout( )    kidAdded(index, constr, l)    kidRemoved(i, l)    laidout( )    load(JSON)    off([eventName], [path], [cb])    on([eventName], [path], cb)    paintComponent(g)    paintViewAt(g, ax, ay, v)    properties([path], props)    property([path], name, value)    recalc( )    relocated(px, py)    remove(c)    removeAll( )    removeAt(i)    removeByConstraints(ctr)    removeMe([after])    repaint([x], [y], [w], [h])    requestFocus( )    requestFocusIn([timeout])    resized(pw, ph)    setAt(i, d)    setBackground(v)    setBorder([v])    setBottomPadding(bottom)    setBounds(x, y, w, h)    setByConstraints(constr, c)    setConstraints(ctr)    setEnabled(b)    setId(id)    setKids(a)    setLayout(m)    setLeftPadding(left)    setLocation(xx, yy)    setPadding(v)    setParent(o)    setPreferredSize(w, h)    setProperties([path], props)    setRightPadding(right)    setSize(w, h)    setTopPadding(top)    setVisible(b)    toBack( )    toFront( )    toPreferredHeight( )    toPreferredSize( )    toPreferredWidth( )    toView(target)    validate( )    validateMetric( )    vrp( )   


public void fired (src)

Combo box button listener method. The method triggers showing combo box pad window when the combo button has been pressed


Parameters:
public <Object> getValue ( )

Get the current combo box selected value


Returns: <Object>

a value

public chainable hidePad ( )

Hide combo drop down list

public <Boolean> isPadShown ( )

Test if the combo window pad is shown


Returns: <Boolean>

true if the combo window pad is shown

public void keyPressed (e)

Define key pressed events handler


Parameters:
public void keyTyped (e)

Define key typed events handler


Parameters:
public void pointerPressed (e)

Define pointer pressed events handler


Parameters:
public chainable select (i)

Select the given value from the list as the combo box value


Parameters:
  • i <Integer>

    an index of a list element to be selected as the combo box value

protected void selected (src, data)

Combo pad list listener method. Called every time an item in combo pad list has been selected.


Parameters:
public chainable setEditable (b)

Make the commbo editable


Parameters:
  • b <Boolean>

    true to make the combo ediatable

public chainable setList (l)

Bind the given list component to the combo box component.


Parameters:
public chainable setMaxPadHeight (h)

Set the maximal height of the combo box pad element.


Parameters:
  • h <Integer>

    a maximal combo box pad size

public chainable setSelectView (c)

Set the given combo box selection view


Parameters:
public chainable setValue (v)

Set combo box value selected value.


Parameters:
public chainable showPad ( )

Show combo drop down list



Inherited attributes:
public zebkit.draw.View bg    public zebkit.draw.View border    public Boolean canHaveFocus    public Object constraints    public Integer height    public Boolean isEnabled    public Boolean isValid    public Boolean isVisible    public Array kids    public zebkit.layout.Layout layout    public zebkit.layout.Layoutable parent    public Integer width    public Integer x    public Integer y   



public <zebkit.ui.Panel> adjustPadTo

A component the combo win pad has to be adjusted.

public <zebkit.ui.Panel> button

Reference to combo box button component

public <zebkit.ui.Panel> content

Reference to combo box content component

public <zebkit.ui.BaseList> list

Reference to combo box list component

public <zebkit.ui.BaseList> list

Reference to combo box winpad list component

public <Integer> maxPadHeight

Maximal size the combo box height can have

public <zebkit.draw.View> selectView

Reference to selection view

public <zebkit.ui.Panel> winpad

Reference to combo box pad component




padShown

Implement the event handler method to detect when a combo pad window is shown or hidden

    var p = new zebkit.ui.Combo();
    p.padShown = function(src, b) { ... }; // add event handler

Parameters:
  • src <zebkit.ui.Combo>

    a combo box component that triggers the event

  • b <Boolean>

    a flag that indicates if the combo pad window has been shown (true) or hidden (false)

selected

Fired when a new value in a combo box component has been selected

    combo.on("selected", function(combo, value) {
        ...
    });

Parameters:
  • combo <zebkit.ui.Combo>

    a combo box component where a new value has been selected

  • value <Object>

    a previously selected index