controlP5
Class ControlGroup

java.lang.Object
  extended by controlP5.ControllerGroup
      extended by controlP5.ControlGroup
All Implemented Interfaces:
ControllerInterface, ControlListener, ControlP5Constants
Direct Known Subclasses:
ColorPicker, ListBox, RadioButton, ScrollList

public class ControlGroup
extends ControllerGroup
implements ControlListener

use a controlGroup to bundle several controllers, controlGroups can be closed and opened to keep the screen organized. ControlGroup extends ControllerGroup, for a list and documentation of available methods see the ControllerGroup documentation.

+Example
/**
 * ControlP5 Group
 * by andreas schlegel, 2009
 */
import controlP5.*;

ControlP5 controlP5;

void setup() {
  size(400,400);
  frameRate(30);

  controlP5 = new ControlP5(this);
  ControlGroup l = controlP5.addGroup("myGroup",100,200);
  controlP5.addBang("A-1",0,4,20,20).setGroup(l);
  controlP5.addBang("A-2",30,4,20,20).setGroup(l);
  l.setBackgroundColor(color(255,100));
  l.setBackgroundHeight(150);
  println("the height of controlgroup l: "+l.getBackgroundHeight());
  
  ControlGroup l2 = controlP5.addGroup("myGroup2",100,40,200);
  l2.activateEvent(true);
  
  
  controlP5.addBang("B-1",0,4,20,20).setGroup(l2);
  Radio r = controlP5.addRadio("radio",100,4);
  r.add("black",0);
  r.add("red",1);
  r.add("green",2);
  r.add("blue",3);
  r.add("grey",4);
  r.setColorLabel(0xffff0000);
  r.setGroup(l2);
  
  
}

void draw() {
  background(0);
}


void controlEvent(ControlEvent theEvent) {
  if(theEvent.isGroup()) {
    println("got an event from group "+theEvent.group().name()+", isOpen? "+theEvent.group().isOpen());  
  } else if (theEvent.isController()){
    println("got something from a controller "+theEvent.controller().name());
  }
}


void keyPressed() {
  if(key==' ') {
    controlP5.group("myGroup").remove();
  }
}

Field Summary
 
Fields inherited from interface controlP5.ControlP5Constants
acceptClassList, ACTIVE, ALT, ARC, ARRAY, BACKSPACE, BOOLEAN, BOTTOM, CENTER, CONTROL, controlEventClass, CUSTOM, DECREASE, DEFAULT, DELETE, DOWN, ELLIPSE, ENTER, ESCAPE, EVENT, eventMethod, FIELD, FLOAT, HALF_PI, HIDE, HIGHLIGHT, HORIZONTAL, IMAGE, INCREASE, INTEGER, INVALID, KEYCONTROL, LEFT, LINE, LOAD, MENU, METHOD, MOVE, OVER, PI, PRESSED, PRINT, RELEASE, RESET, RIGHT, SAVE, SHIFT, SPRITE, STRING, SWITCH, SWITCH_BACK, SWITCH_FORE, TAB, TOP, TWO_PI, UP, VERBOSE, VERTICAL
 
Constructor Summary
ControlGroup(ControlP5 theControlP5, ControllerGroup theParent, java.lang.String theName, int theX, int theY, int theW, int theH)
           
 
Method Summary
 ControlGroup activateEvent(boolean theFlag)
          activate or deactivate the Event status of a tab.
 void addCloseButton()
          TODO redesign or deprecate add a close button to the controlbar of this controlGroup.
 void addToXMLElement(ControlP5XMLElement theElement)
           
 float[] arrayValue()
           
 void controlEvent(ControlEvent theEvent)
          ControlListener is an interface that can be implemented by a custom class.
 int getBackgroundHeight()
          get the height of the controlGroup's background.
 void hideBar()
           
 boolean isBarVisible()
           
 void mousePressed()
           
 void removeCloseButton()
          TODO redesign or deprecate remove the close button.
 void setArrayValue(float[] theArray)
           
 void setBackgroundColor(int theColor)
          set the background color of a controlGroup.
 void setBackgroundHeight(int theHeight)
          set the height of the controlGroup's background.
 void setBarHeight(int theHeight)
          set the height of the top bar (used to open/close and move a controlGroup).
 void showBar()
           
 java.lang.String stringValue()
          !!! experimental, see ControllerGroup.value()
 java.lang.String toString()
           
 float value()
          !!! experimental, see ControllerGroup.value()
 
Methods inherited from class controlP5.ControllerGroup
absolutePosition, add, addCanvas, addDrawable, captionLabel, close, color, continuousUpdateEvents, controller, disableCollapse, draw, enableCollapse, getAsXML, getColor, getHeight, getPickingColor, getTab, getWidth, getWindow, hide, id, init, isCollapse, isMoveable, isOpen, isUpdate, isVisible, isXMLsavable, keyEvent, moveTo, moveTo, moveTo, moveTo, moveTo, moveTo, moveTo, moveTo, name, open, parent, position, remove, remove, remove, removeCanvas, setColorActive, setColorBackground, setColorForeground, setColorLabel, setColorValue, setGroup, setGroup, setHeight, setId, setLabel, setMousePressed, setMoveable, setOpen, setPosition, setTab, setTab, setTab, setUpdate, setVisible, setWidth, show, update, updateAbsolutePosition, updateEvents, updateInternalEvents, valueLabel
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ControlGroup

public ControlGroup(ControlP5 theControlP5,
                    ControllerGroup theParent,
                    java.lang.String theName,
                    int theX,
                    int theY,
                    int theW,
                    int theH)
Method Detail

mousePressed

public void mousePressed()

activateEvent

public ControlGroup activateEvent(boolean theFlag)
activate or deactivate the Event status of a tab.

Parameters:
theFlag - boolean

getBackgroundHeight

public int getBackgroundHeight()
get the height of the controlGroup's background.

Returns:

setBackgroundHeight

public void setBackgroundHeight(int theHeight)
set the height of the controlGroup's background.

Parameters:
theHeight -

setBackgroundColor

public void setBackgroundColor(int theColor)
set the background color of a controlGroup.

Parameters:
theColor -

setBarHeight

public void setBarHeight(int theHeight)
set the height of the top bar (used to open/close and move a controlGroup).

Parameters:
theHeight -

addToXMLElement

public void addToXMLElement(ControlP5XMLElement theElement)
Specified by:
addToXMLElement in interface ControllerInterface
Parameters:
theElement - ControlP5XMLElement

addCloseButton

public void addCloseButton()
TODO redesign or deprecate add a close button to the controlbar of this controlGroup.


removeCloseButton

public void removeCloseButton()
TODO redesign or deprecate remove the close button.


hideBar

public void hideBar()

showBar

public void showBar()

isBarVisible

public boolean isBarVisible()

controlEvent

public void controlEvent(ControlEvent theEvent)
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
Parameters:
theEvent - ControlEvent Controller

stringValue

public java.lang.String stringValue()
!!! experimental, see ControllerGroup.value()

Specified by:
stringValue in interface ControllerInterface
Overrides:
stringValue in class ControllerGroup
Returns:
String

value

public float value()
!!! experimental, see ControllerGroup.value()

Specified by:
value in interface ControllerInterface
Overrides:
value in class ControllerGroup
Returns:
float

arrayValue

public float[] arrayValue()
Overrides:
arrayValue in class ControllerGroup

setArrayValue

public void setArrayValue(float[] theArray)

toString

public java.lang.String toString()
Overrides:
toString in class ControllerGroup


processing library controlP5 by Andreas Schlegel. (c) 2010