# MultiListButton (Javadocs: controlP5)
Date: 2014-04-27

controlP5

## Class MultiListButton

- java.lang.Object
- - controlP5.Controller<Button>
  - - controlP5.Button
    - - controlP5.MultiListButton

All Implemented Interfaces:
  CDrawable, ControllerInterface<Button>, ControlP5Constants

    public class MultiListButton
    extends Button

Used by MultiList.

+Example
  `

      /**
       * ControlP5 MultiList
       * by andreas schlegel, 2009
       */

      import controlP5.*;

      ControlP5 controlP5;
      MultiList l;

      void setup() {
        size(700,400);
        frameRate(30);
        controlP5 = new ControlP5(this);

        // add a multiList to controlP5.
        // elements of the list have default dimensions
        // here, a width of 100 and a height of 12
        l = controlP5.addMultiList("myList",20,20,100,12);

        // create a multiListButton which we will use to
        // add new buttons to the multilist
        MultiListButton b;
        b = l.add("level1",1);

        // add items to a sublist of button "level1"
        b.add("level11",11).setLabel("level1 item1");
        b.add("level12",12).setLabel("level1 item2");

        b = l.add("level2",2);

        int cnt = 100;

        // add some more sublists.
        for(int i=0;i<10;i++) {
          MultiListButton c = b.add("level2"+(i+1),20+i+1);
          c.setLabel("level2 item"+(i+1));
          c.setColorBackground(color(64 + 18*i,0,0));

          if(i==4) {
          // changing the width and the height of a button
          // will be inherited by its sublists.
          c.setWidth(100);
          c.setHeight(20);
          }
          cnt++;

          if(i==4) {
            for(int j=0;j<10;j++) {
              cnt++;
              MultiListButton d;
              d = c.add("level2"+i+""+j,250+j+1);
              d.setLabel("level2 item"+(i+1)+" "+"item"+(j+1));
              d.setColorBackground(color(64 + 18*j,(64 + 18*j)/2,0));
              d.setId(cnt);
              d.setWidth(200);
            }
          }
        }

        MultiListButton cc = (MultiListButton)controlP5.controller("level21");
        cc.setHeight(40);
      }

      void controlEvent(ControlEvent theEvent) {
        println(theEvent.controller().name()+" = "+theEvent.value());
        // uncomment the line below to remove a multilist item when clicked.
        // theEvent.controller().remove();
      }

      void draw() {
        background(0);
      }

      void keyPressed() {
        if(controlP5.controller("level23")!=null) {
          println("removing multilist button level23.");
          controlP5.controller("level23").remove();
        }
      }

  `

### Field Summary

### Fields inherited from class controlP5.Button

`autoHeight, autoWidth`

### Fields inherited from class controlP5.Controller

`autoSpacing`

### Fields inherited from interface controlP5.ControlP5Constants

`acceptClassList, ACTION_BROADCAST, ACTION_CLICK, ACTION_DRAG, ACTION_ENTER, ACTION_EXIT, ACTION_LEAVE, ACTION_MOVE, ACTION_PRESS, ACTION_PRESSED, ACTION_RELEASE, ACTION_RELEASED, ACTION_RELEASEDOUTSIDE, ACTION_WHEEL, ACTIVE, ALL, ALT, AQUA, ARC, ARRAY, BACKSPACE, BASELINE, BITFONT, BLACK, BLUE, BOOLEAN, BOTTOM, BOTTOM_OUTSIDE, CAPTIONLABEL, CENTER, CHECKBOX, COMMANDKEY, CONTROL, controlEventClass, CUSTOM, DECREASE, DEFAULT, DELETE, DONE, DOWN, DROPDOWN, ELLIPSE, ENTER, ESCAPE, EVENT, eventMethod, FADEIN, FADEOUT, FIELD, FLOAT, FUCHSIA, GRAY, GREEN, grixel, HALF_PI, HIDE, HIGHLIGHT, HORIZONTAL, IDLE, IMAGE, INACTIVE, INCREASE, INTEGER, INVALID, J2D, KEYCONTROL, LEFT, LEFT_OUTSIDE, LIME, LINE, LIST, LOAD, MAROON, MENU, METHOD, MOVE, MULTI, MULTIPLES, NAVY, OLIVE, ORANGE, OVER, P2D, P3D, PI, PRESSED, PRINT, PURPLE, RED, RELEASE, RESET, RIGHT, RIGHT_OUTSIDE, SAVE, SHIFT, SILVER, SINGLE, SINGLE_COLUMN, SINGLE_ROW, SPRITE, standard56, standard58, STRING, SWITCH, SWITCH_BACK, SWITCH_FORE, synt24, TAB, TEAL, THEME_A, THEME_CP52014, THEME_CP5BLUE, THEME_RED, THEME_RETRO, THEME_WHITE, TOP, TOP_OUTSIDE, TRANSITION_WAIT_FADEIN, TREE, TWO_PI, UP, VALUELABEL, VERBOSE, VERTICAL, WAIT, WHITE, YELLOW`

### Method Summary

Methods
`MultiListButton` `add(java.lang.String theName, float theValue)` add a new button to the sublist of this multilist button.
`void` `close()`
`void` `close(controlP5.MultiListInterface theInterface)`
`void` `draw(processing.core.PGraphics theGraphics)`
`java.util.List<MultiListButton>` `getChildren()` Deprecated.
`int` `getDirection()`
`void` `mouseReleasedOutside()`
`java.lang.String` `name()`
`boolean` `observe()`
`void` `open()`
`void` `remove()` removes a controller from controlP5.
`MultiListButton` `setHeight(int theHeight)` set the height of a multlist button.
`MultiListButton` `setWidth(int theWidth)` set the width of a multlist button.
`MultiListButton` `toUpperCase(boolean theValue)`
`void` `updateLocation(float theX, float theY)`
`void` `updateRect(float theX, float theY, float theW, float theH)`

### Methods inherited from class controlP5.Button

`activateBy, getBooleanValue, getInfo, isOn, isPressed, mousePressed, mouseReleased, setOff, setOn, setSwitch, setValue, toString, update, updateDisplayMode, updateViewMode`

### Methods inherited from class controlP5.Controller

`add, addCallback, addListener, align, bringToFront, bringToFront, changeValue, continuousUpdateEvents, draw, getAbsolutePosition, getAddress, getArrayValue, getArrayValue, getBehavior, getCaptionLabel, getColor, getControllerPlugList, getControlWindow, getDecimalPrecision, getDefaultValue, getHeight, getId, getLabel, getMax, getMin, getName, getParent, getPickingColor, getPointer, getPosition, getProperty, getProperty, getStringValue, getTab, getValue, getValueLabel, getView, getWidth, getWindow, hide, init, isActive, isBroadcast, isInside, isLabelVisible, isListening, isLock, isMouseOver, isMousePressed, isMoveable, isUpdate, isUserInteraction, isVisible, keyEvent, linebreak, listen, listenerSize, lock, moveTo, moveTo, moveTo, moveTo, moveTo, moveTo, moveTo, moveTo, moveTo, plugTo, plugTo, plugTo, plugTo, registerProperty, registerProperty, registerTooltip, remove, removeBehavior, removeCallback, removeCallback, removeListener, removeProperty, removeProperty, setAbsolutePosition, setAddress, setArrayValue, setArrayValue, setBehavior, setBroadcast, setCaptionLabel, setColor, setColorActive, setColorBackground, setColorCaptionLabel, setColorForeground, setColorValueLabel, setDecimalPrecision, setDefaultValue, setGroup, setGroup, setId, setImage, setImage, setImages, setImages, setImages, setLabelVisible, setLock, setMax, setMin, setMouseOver, setMousePressed, setMoveable, setParent, setPosition, setPosition, setSize, setSize, setStringValue, setTab, setTab, setUpdate, setUserInteraction, setValueLabel, setValueSelf, setView, setView, setVisible, show, unlock, unplugFrom, unplugFrom, unregisterTooltip, updateAbsolutePosition, updateEvents, updateInternalEvents, updateSize`

### Methods inherited from class java.lang.Object

`equals, getClass, hashCode, notify, notifyAll, wait, wait, wait`

### Methods inherited from interface controlP5.ControllerInterface

`parent, setColorLabel, setColorValue, setLabel`

### Method Detail

#### add

    public MultiListButton add(java.lang.String theName,
                      float theValue)

add a new button to the sublist of this multilist button.

Parameters:
  `theName` - String
  `theValue` - int
Returns:
  MultiListButton

#### close

    public void close()

#### close

    public void close(controlP5.MultiListInterface theInterface)

#### getChildren

    @Deprecated
    public java.util.List<MultiListButton> getChildren()

Deprecated.

#### getDirection

    public int getDirection()

#### mouseReleasedOutside

    public void mouseReleasedOutside()

Overrides:
  `mouseReleasedOutside` in class `Button`

#### observe

    public boolean observe()

#### open

    public void open()

#### remove

    public void remove()

Description copied from class: `Controller`
removes a controller from controlP5.

Specified by:
  `remove` in interface `ControllerInterface<Button>`
Overrides:
  `remove` in class `Controller<Button>`

#### setHeight

    public MultiListButton setHeight(int theHeight)

set the height of a multlist button.

Overrides:
  `setHeight` in class `Controller<Button>`
Parameters:
  `theHeight` - int
Returns:
  Controller

#### setWidth

    public MultiListButton setWidth(int theWidth)

set the width of a multlist button.

Overrides:
  `setWidth` in class `Controller<Button>`
Parameters:
  `theWidth` - int
Returns:
  Controller

#### toUpperCase

    public MultiListButton toUpperCase(boolean theValue)

#### updateLocation

    public void updateLocation(float theX,
                      float theY)

#### updateRect

    public void updateRect(float theX,
                  float theY,
                  float theW,
                  float theH)

#### draw

    public void draw(processing.core.PGraphics theGraphics)

#### name

    public java.lang.String name()