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

## controlP5
Interface ControlListener

All Known Implementing Classes:
  Accordion, CheckBox, ColorPicker, ControlGroup, ControllerGroup, DropdownList, Group, ListBox, MultiList, Radio, RadioButton, Tab, Textarea

    public interface ControlListener

ControlListener is an interface that can be implemented by a custom class to be notified when controller values change. To add a ControlListener to a controller use ÊController.addListner()

See Also:
  `Controller.addListener(ControlListener)`, `CallbackListener`
  +Example
    `

        /**
         * ControlP5 Listener.
         * the ControlListener interface can be used to implement a custom
         * ControlListener which listens for incoming ControlEvent from specific
         * controller(s). MyControlListener in the example below listens to
         * ControlEvents coming in from controller 'mySlider'.
         *
         * by andreas schlegel, 2012
         */
        import controlP5.*;

        ControlP5 cp5;
        MyControlListener myListener;

        void setup() {
          size(700,400);

          cp5 = new ControlP5(this);
          cp5.setColor(new CColor(0xffaa0000, 0xff330000, 0xffff0000, 0xffffffff, 0xffffffff));

          cp5.addSlider("mySlider")
             .setRange(100,200)
             .setValue(140)
             .setPosition(200,200)
             .setSize(100,20);

          myListener = new MyControlListener();

          cp5.getController("mySlider").addListener(myListener);
        }

        void draw() {
          background(myListener.col);
        }

        class MyControlListener implements ControlListener {
          int col;
          public void controlEvent(ControlEvent theEvent) {
            println("i got an event from mySlider, " +
                    "changing background color to "+
                    theEvent.getController().getValue());
            col = (int)theEvent.getController().getValue();
          }

        }

    `

Method Summary
`void` | `controlEvent(ControlEvent theEvent)` controlEvent is called by controlP5's ControlBroadcaster to inform available listeners about value changes.

Method Detail

### controlEvent

    void controlEvent(ControlEvent theEvent)

  controlEvent is called by controlP5's ControlBroadcaster to inform available listeners about value changes. Use the CallbackListener to get informed when actions such as pressed, release, drag, etc are performed.

  Parameters:
    `theEvent` - ControlEvent
  See Also:
    `CallbackListener`, `CallbackEvent`

Package | Class | Tree | 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) 2006-2012