Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## controlP5
Class ScrollList

    java.lang.Object
      controlP5.ControllerGroup
          controlP5.ControlGroup
              controlP5.ScrollList

All Implemented Interfaces:
  ControllerInterface, ControlListener, ControlP5Constants

Deprecated.

    public class ScrollList

extends ControlGroup
implements ControlListener

+Example

      /**
        * ControlP5 scrollList. depricated, use listBox.
        *
        * by andreas schlegel, 2009
        */

      import controlP5.*;

      ControlP5 controlP5;

      ScrollList l;

      void setup() {
        size(400,400);
        frameRate(30);
        controlP5 = new ControlP5(this);
        controlP5.setControlFont(new ControlFont(createFont("Times",20),14));
        l = controlP5.addScrollList("myList",100,100,220,280);
        l.setItemHeight(30);
        l.setBarHeight(20);

        l.captionLabel().toUpperCase(false);
        l.captionLabel().set("something else");
        l.captionLabel().style().marginTop = 4;
        for(int i=0;i<40;i++) {
          controlP5.Button b = l.addItem("a"+i,i);
          b.setId(100 + i);
        }
      }

      void controlEvent(ControlEvent theEvent) {
        // ScrollList is of type ControlGroup.
        // when an item in a scrollList is activated,
        // 2 controlEvents will be broadcasted.
        // the first one event is triggered from the ScrollList,
        // the second one from the button that has been pressed
        // inside the scrollList.
        // to avoid an error message from controlP5, you
        // need to check what type of item did trigger the
        // event, either a controller or a group.
        if(theEvent.isController()) {
          // an event from a controller e.g. button
          println(theEvent.controller().value()+" from "+theEvent.controller());
        }
        else if (theEvent.isGroup()) {
          // an event from a group e.g. scrollList
          println(theEvent.group().value()+" from "+theEvent.group());
        }
      }

      void keyPressed() {
        if(key=='r') {
          l.removeItem("a"+int(random(40)) );
        }
        else if(key=='a') {
          l.addItem("a"+int(random(40)), int(random(100)) );
        }
      }
      void draw() {
        background(0);
        // scroll the scroll List according to the mouseX position
        // when holding down SPACE.
        if(keyPressed && key==' ') {
          l.scroll(mouseX/((float)width)); // scroll taks values between 0 and 1
        }
      }

Field Summary

Fields inherited from interface controlP5.ControlP5Constants
`acceptClassList, ACTION_BROADCAST, ACTION_ENTER, ACTION_LEAVE, ACTION_PRESSED, ACTION_RELEASED, ACTION_RELEASEDOUTSIDE, ACTIVE, ALT, ARC, ARRAY, BACKSPACE, BOOLEAN, BOTTOM, CENTER, CONTROL, controlEventClass, CUSTOM, DECREASE, DEFAULT, DELETE, DONE, DOWN, ELLIPSE, ENTER, ESCAPE, EVENT, eventMethod, FADEIN, FADEOUT, FIELD, FLOAT, HALF_PI, HIDE, HIGHLIGHT, HORIZONTAL, IDLE, IMAGE, INACTIVE, INCREASE, INTEGER, INVALID, KEYCONTROL, LEFT, LINE, LOAD, MENU, METHOD, MOVE, MULTIPLES, OVER, PI, PRESSED, PRINT, RELEASE, RESET, RIGHT, SAVE, SHIFT, SINGLE_COLUMN, SINGLE_ROW, SPRITE, STRING, SWITCH, SWITCH_BACK, SWITCH_FORE, TAB, TOP, TWO_PI, UP, VERBOSE, VERTICAL, WAIT`

Method Summary
`Button` | `addItem(java.lang.String theName, int theValue)` Deprecated. add an item to the scrollList.
`void` | `controlEvent(ControlEvent theEvent)` Deprecated. ControlListener is an interface that can be implemented by a custom class.
`void` | `hideScrollbar()` Deprecated.
`boolean` | `isScrollbarVisible()` Deprecated.
`void` | `removeItem(java.lang.String theItemName)` Deprecated. remove an item from the scroll list.
`void` | `scroll(float theValue)` Deprecated. scroll the scrollList remotely.
`void` | `setItemHeight(int theHeight)` Deprecated.
`void` | `showScrollbar()` Deprecated.

Methods inherited from class controlP5.ControlGroup
`activateEvent, addCloseButton, addListener, getBackgroundHeight, getBarHeight, hideBar, info, isBarVisible, listenerSize, mousePressed, removeCloseButton, removeListener, setBackgroundColor, setBackgroundHeight, setBarHeight, showBar, stringValue, toString`

Methods inherited from class controlP5.ControllerGroup
`absolutePosition, add, addCanvas, addDrawable, arrayValue, captionLabel, close, color, continuousUpdateEvents, controller, disableCollapse, draw, enableCollapse, getAbsolutePosition, getArrayValue, getColor, getController, getHeight, getId, getName, getPickingColor, getPosition, getProperty, getProperty, getStringValue, getTab, getValue, getWidth, getWindow, hide, id, init, isCollapse, isMoveable, isOpen, isUpdate, isVisible, keyEvent, moveTo, moveTo, moveTo, moveTo, moveTo, moveTo, moveTo, moveTo, name, open, parent, position, registerProperty, registerProperty, remove, remove, remove, removeCanvas, removeProperty, removeProperty, setAbsolutePosition, setArrayValue, setColor, setColorActive, setColorBackground, setColorForeground, setColorLabel, setColorValue, setGroup, setGroup, setHeight, setId, setLabel, setMousePressed, setMoveable, setOpen, setPosition, setPosition, setTab, setTab, setTab, setUpdate, setValue, setVisible, setWidth, show, update, updateAbsolutePosition, updateEvents, updateInternalEvents, value, valueLabel`

Methods inherited from class java.lang.Object
`equals, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Method Detail

### hideScrollbar

    public void hideScrollbar()

  Deprecated.

### showScrollbar

    public void showScrollbar()

  Deprecated.

### isScrollbarVisible

    public boolean isScrollbarVisible()

  Deprecated.

### scroll

    public void scroll(float theValue)

  Deprecated.
  scroll the scrollList remotely. values must range from 0 to 1.

  Parameters:
    `theValue` -

### setItemHeight

    public void setItemHeight(int theHeight)

  Deprecated.

### addItem

    public Button addItem(java.lang.String theName,
                          int theValue)

  Deprecated.
  add an item to the scrollList.

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

### removeItem

    public void removeItem(java.lang.String theItemName)

  Deprecated.
  remove an item from the scroll list.

  Parameters:
    `theItemName` - String

### controlEvent

    public void controlEvent(ControlEvent theEvent)

  Deprecated.
  Description copied from interface: `ControlListener`
  ControlListener is an interface that can be implemented by a custom class. add the controlListener to a controller with Controller.addListner()

  Specified by:
    `controlEvent` in interface `ControlListener`
  Overrides:
    `controlEvent` in class `ControlGroup`
  Parameters:
    `theEvent` - ControlEvent

Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

processing library controlP5 by Andreas Schlegel. (c) 2011