<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
      <title>Tagged with addscrollablelist() - Processing 2.x and 3.x Forum</title>
      <link>https://forum.processing.org/two/discussions/tagged/feed.rss?Tag=addscrollablelist%28%29</link>
      <pubDate>Sun, 08 Aug 2021 18:25:55 +0000</pubDate>
         <description>Tagged with addscrollablelist() - Processing 2.x and 3.x Forum</description>
   <language>en-CA</language>
   <atom:link href="/two/discussions/taggedaddscrollablelist%28%29/feed.rss" rel="self" type="application/rss+xml" />
   <item>
      <title>Rotating previously rotated text.</title>
      <link>https://forum.processing.org/two/discussion/27837/rotating-previously-rotated-text</link>
      <pubDate>Tue, 24 Apr 2018 04:24:00 +0000</pubDate>
      <dc:creator>Neowso</dc:creator>
      <guid isPermaLink="false">27837@/two/discussions</guid>
      <description><![CDATA[<p>I am trying to rotate text to shift a it a few degrees clockwise to that it protrudes from the middle section of each arc. However, any time I use the rotate function it throws it way off.
Any tips on what to use. I know it's the 'rotate()' function but I'm not getting it right.</p>

<p>Thanks in advance :)</p>

<pre><code>    float delta = TWO_PI / childrenA.length; 
    float xPos = width/2+scaler/2*arrayDueTimes.get(i) * cos(i* delta); 
    float yPos = height/2+scaler/2*arrayDueTimes.get(i) * sin(i* delta);

    pushMatrix();
      translate(xPos, yPos);
      rotate(delta * i);
      fill(0);
      text(i + "--------------------", 0, 0); 
    popMatrix(); 
</code></pre>
]]></description>
   </item>
   <item>
      <title>How to play random sound file when clicking an item within a scrollable list (controlP5 library)?</title>
      <link>https://forum.processing.org/two/discussion/27834/how-to-play-random-sound-file-when-clicking-an-item-within-a-scrollable-list-controlp5-library</link>
      <pubDate>Mon, 23 Apr 2018 23:28:42 +0000</pubDate>
      <dc:creator>Neowso</dc:creator>
      <guid isPermaLink="false">27834@/two/discussions</guid>
      <description><![CDATA[<p>I'm using the 'scrollableList' from the controlP5 library. I wish to simply play a random sound file each time I click an element on the scrollable list, without pausing.</p>

<p>I have tried a few things. I am having limited success with some code from <a href="/two/profile/akenaton">@akenaton</a> that I found in this thread:
<a rel="nofollow" href="https://forum.processing.org/two/discussion/8949/how-do-i-play-a-random-audio-sample">https://forum.processing.org/two/discussion/8949/how-do-i-play-a-random-audio-sample</a></p>

<p>I merged that code with the scrollable list. So far, I'm only managing to pause the audio on clicking the menu. I am probably missing something obvious.</p>

<p>As ever, any tips much appreciated :)</p>

<pre><code>import ddf.minim.*;
import controlP5.*;
import java.util.*;
AudioPlayer player;
Minim minim;
ControlP5 cp5;

boolean playeurInit = false;// que leplayer n'est pas lancé
boolean stop = true;

String[] table = {"train1.wav", "train2.wav"};

int randomWav; 
String wav; 

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

  minim = new Minim(this);
  int randomWav = int(random(table.length));
  String son = table[randomWav];
  //println(son);
  player = minim.loadFile(son);
  player.pause();   

  cp5 = new ControlP5(this);
  List l = Arrays.asList("a", "b", "c", "d", "e", "f", "g", "h");
  cp5.addScrollableList("dropdown").setPosition(10, 10).setSize(200, 100).setBarHeight(20).setItemHeight(20).addItems(l);   
}


void draw() {
  background(240);
  if (!stop) {
    if (player.isPlaying() == false) {
          randomWav = int(random(table.length));
          println(randomWav);
          wav = table[randomWav];
          player = minim.loadFile(wav);
          player.play();
          player.loop();//you can change that!
          playeurInit = true;
     }
  }
}


void dropdown(int n) {
  if(stop == true)
  {
    stop = false;
  }else{
    stop = true;
    player.play();
    if (player.isPlaying() == true ) 
    {
      player.pause();
      //player.play();
    }
  }

  CColor c = new CColor();
  c.setBackground(color(255,0,0));
  cp5.get(ScrollableList.class, "dropdown").getItem(n).put("color", c);
}


void stop(){
  player.close();
  minim.stop();
  super.stop();
}
</code></pre>
]]></description>
   </item>
   <item>
      <title>How to take data from a ControlP5 scrollable list, and use it to select a row in spreadsheet?</title>
      <link>https://forum.processing.org/two/discussion/21226/how-to-take-data-from-a-controlp5-scrollable-list-and-use-it-to-select-a-row-in-spreadsheet</link>
      <pubDate>Tue, 07 Mar 2017 16:27:20 +0000</pubDate>
      <dc:creator>Attrup</dc:creator>
      <guid isPermaLink="false">21226@/two/discussions</guid>
      <description><![CDATA[<p>Hello
I'm trying to make a program which calculates values which it gets from a spreadsheet. I'm using a ControlP5 scrollable list to show all the possible selection. Each item in the list represents a row in the spreadsheet. To each row there is 7 columns.</p>

<p>So my question is how do i let processing know or rather code, that the item selected in the list is a row in the spreadsheet? It's very poorly explained i know, but i will try to explain further if need! Thank you so much in advance!</p>

<p>A simplified version of my code:</p>

<p>`</p>

<pre><code>    import controlP5.*;
    import java.util.*;

    ControlP5 cp5;

    ScrollableList initialBodyList;

    Button butDeltaVplanet;

    Table Planeter;

    Textfield required_delta_V;

    void setup() {
      size(500, 500);
      cp5 = new ControlP5(this);

       Planeter = loadTable("DatasheetPlanets.csv", "header");

      butDeltaVplanet = cp5.addButton("Calculate required Delta V")
        .setPosition(300, 50)
        .setColorForeground(#EA0037)
        .setColorActive(#FF4343)
        .setSize(130, 30);
      List body = Arrays.asList("Kerbol", "Moho", "Eve", "     Gilly", "Kerbin", "     Mun", "     Minmus", "Duna", "     Ike", "Dres", "Jool", "     Laythe", "     Vall", "     Tylo", "     Bop", "     Pol", "Eeloo");

      initialBodyList = cp5.addScrollableList("Initial body")
        .setPosition(70, 50)
        .setSize(200, 300)
        .setBarHeight(30)
        .setItemHeight(20)
        .setBackgroundColor(#EA0037)
        .setColorForeground(#EA0037)
        .setColorActive(#FF4343)
        .addItems(body)
        .setOpen(false);

      required_delta_V = cp5.addTextfield("Required Delta V m/s")
        .setPosition(300, 120)
        .setSize(130, 30);


      ControlP5.printPublicMethodsFor(Textfield.class);
    }

    void draw() {
      background(200);
    }

    public void controlEvent(ControlEvent theEvent) {

      if (theEvent.isFrom(butDeltaVplanet)) {

        int planet1 = Planeter.getRow(3).getInt("DeltaVtoKerbinorbit");

        int planet2 = Planeter.getRow(4).getInt("DeltaVtoKerbinorbit");

        float deltaV = 0;

        deltaV = planet1 + planet2;

        required_delta_V.setText("   " + deltaV);
      }
    }`
</code></pre>
]]></description>
   </item>
   <item>
      <title>Get Selected Item value from ScrollableList</title>
      <link>https://forum.processing.org/two/discussion/20391/get-selected-item-value-from-scrollablelist</link>
      <pubDate>Sat, 21 Jan 2017 11:41:29 +0000</pubDate>
      <dc:creator>Rocks</dc:creator>
      <guid isPermaLink="false">20391@/two/discussions</guid>
      <description><![CDATA[<p>I am getting error in recovering the Item Value set using .setvalue(0). Also please guide how to use when users change the default value.</p>

<pre><code>`//Imports
import processing.serial.*;
import controlP5.*;
import java.util.*;

//Variable Declarations
ControlP5 lstPortList;
ControlP5 lstBaud;
String tport;
int tbaud;
Serial myPort;      // The serial port
int whichKey = -1;  // Variable to hold keystoke values
int inByte = -1;    // Incoming serial data
int Indexport =0;
int Indexbaud =1;

///Setup/////
void setup() {
  size(400, 400);
  // create a font with the third font available to the system:
  PFont myFont = createFont(PFont.list()[2], 14);
  textFont(myFont);

  // List all the available serial ports:
  // printArray(Serial.list());

  lstPortList = new ControlP5(this);
  String[] portNames =Serial.list();
  lstPortList.addScrollableList("Port")
    .setPosition(10, 10)
      .setSize(100, 100)
        .setBarHeight(20)
          .setItemHeight(20)
            .addItems(portNames)
              .setFont(createFont("Arial", 13))
                .setColorForeground(color(40, 128))
                  .setValue(Indexport);

  lstBaud = new ControlP5(this);
  List BaudList = Arrays.asList("4800", "9600", "19200", "38400", "57600", "115200");
  lstBaud.addScrollableList("Baud")
    .setPosition(200, 10)
      .setSize(100, 100)
        .setBarHeight(20)
          .setItemHeight(20)
            .addItems(BaudList)
              .setFont(createFont("Arial", 13))
                .setColorForeground(color(40, 128))
                  .setValue(Indexbaud);
  tport= port(Indexport);//lstPortList.get(ScrollableList.class, "port").getItem(Indexport).get("text");
  tbaud= baud(Indexbaud); //lstBaud.get(ScrollableList.class, "port").getItem(Indexbaud).get("text");
  myPort = new Serial(this, tport, tbaud );
}

void draw() { 

  background(0);
  text("Last Received: " + inByte, 10, 130);
  text("Last Sent: " + whichKey, 10, 100);
}

void serialEvent(Serial myPort) {
  inByte = myPort.read();
}

void keyPressed() {
  // Send the keystroke out:
  myPort.write(key);
  whichKey = key;
}

String port(int n) {
  return lstPortList.get(ScrollableList.class, "Port").getItem(n).get("text");  
}
int baud(int n) {
  return lstBaud.get(ScrollableList.class, "Baud").getItem(n).get("text");  
}`
</code></pre>

<p>Thanks</p>
]]></description>
   </item>
   <item>
      <title>How to work in andoid with controlP5? Make bigger labels and use keyboard?</title>
      <link>https://forum.processing.org/two/discussion/17912/how-to-work-in-andoid-with-controlp5-make-bigger-labels-and-use-keyboard</link>
      <pubDate>Fri, 19 Aug 2016 20:38:11 +0000</pubDate>
      <dc:creator>JonSh</dc:creator>
      <guid isPermaLink="false">17912@/two/discussions</guid>
      <description><![CDATA[<p>Hi! I have some trouble working with controlP5 and android. I have some scrollable lists and their "head" or "label" size is small. I have make bigger letters but background size is still small. Also how to show keyboard when a textfield is clicked/touched?
And third question is, how to make a part of the field scrollable? Something like a menu or small scrollable window?</p>
]]></description>
   </item>
   <item>
      <title>Accessing selected list elements from ControlP5 dropdown list</title>
      <link>https://forum.processing.org/two/discussion/17787/accessing-selected-list-elements-from-controlp5-dropdown-list</link>
      <pubDate>Mon, 08 Aug 2016 11:59:06 +0000</pubDate>
      <dc:creator>deano</dc:creator>
      <guid isPermaLink="false">17787@/two/discussions</guid>
      <description><![CDATA[<p>Hi guys,</p>

<p>What should I do to be able to print the relevant item? eg: I want the console to print out just the word 'ADD' or 'SUBTRACT' and so on. I want to later use this as part of a String Variable to pass into the default blendMode() function. That way I will be able to allow for user input/choice of blendMode. That way it would read as blendMode(ADD) or blendMode(SUBTRACT).</p>

<p>I tried getName(), etc but was not able to access it. Right now it prints:</p>

<p>1 {text=SUBTRACT, color=bg (0,45,90), fg (0,116,217), active (0,170,255), captionlabel (255,255,255), valuelabel (255,255,255), name=SUBTRACT, state=false, value=1, view=controlP5.ScrollableList$1@66a35419}</p>

<pre><code>import controlP5.*;
import java.util.*;


ControlP5 cp5;

void setup() {
  size(400, 400);
  cp5 = new ControlP5(this);
  List l = Arrays.asList("ADD", "SUBTRACT", "DARKEST ", "LIGHTEST ", "DIFFERENCE", "EXCLUSION", 
  "MULTIPLY", "SCREEN", "OVERLAY", "HARD_LIGHT", "SOFT_LIGHT", "DODGE", "BURN");
  /* add a ScrollableList, by default it behaves like a DropdownList */
  cp5.addScrollableList("dropdown")
    .setPosition(100, 100)
      .setSize(200, 100)
        .setBarHeight(20)
          .setItemHeight(20)
            .addItems(l)
              .setType(ScrollableList.DROPDOWN) // currently supported DROPDOWN and LIST
                ;
}

void draw() {
  background(240);
}

void dropdown(int n) {
  /* request the selected item based on index n */
  println(n, cp5.get(ScrollableList.class, "dropdown").getItem(n));

  //--------------------------------------------------------------------------------------------------------  
  //MY NOTE: what should I do to be able to print the relevant item? eg: I want the console to print out
  // just the word Add or Subtract. I want to later use this as part of a String Variable to pass into 
  // the default blendMode() function. That way I will be able to allow for user input/choice of blendMode. 
  // right now it prints:

  // 1 {text=SUBTRACT, color=bg (0,45,90), fg (0,116,217), active (0,170,255), captionlabel (255,255,255), 
  //valuelabel (255,255,255), name=SUBTRACT, state=false, value=1, view=controlP5.ScrollableList$1@66a35419}
  //--------------------------------------------------------------------------------------------------------  


  /* here an item is stored as a Map  with the following key-value pairs:
   * name, the given name of the item
   * text, the given text of the item by default the same as name
   * value, the given value of the item, can be changed by using .getItem(n).put("value", "abc"); a value here is of type Object therefore can be anything
   * color, the given color of the item, how to change, see below
   * view, a customizable view, is of type CDrawable 
   */

  //   CColor c = new CColor();
  //  c.setBackground(color(255,0,0));
  //  cp5.get(ScrollableList.class, "dropdown").getItem(n).put("color", c);
}


/*
a list of all methods available for the ScrollableList Controller
 use ControlP5.printPublicMethodsFor(ScrollableList.class);
 to print the following list into the console.

 You can find further details about class ScrollableList in the javadoc.

 Format:
 ClassName : returnType methodName(parameter type)


 controlP5.Controller : CColor getColor() 
 controlP5.Controller : ControlBehavior getBehavior() 
 controlP5.Controller : ControlWindow getControlWindow() 
 controlP5.Controller : ControlWindow getWindow() 
 controlP5.Controller : ControllerProperty getProperty(String) 
 controlP5.Controller : ControllerProperty getProperty(String, String) 
 controlP5.Controller : ControllerView getView() 
 controlP5.Controller : Label getCaptionLabel() 
 controlP5.Controller : Label getValueLabel() 
 controlP5.Controller : List getControllerPlugList() 
 controlP5.Controller : Pointer getPointer() 
 controlP5.Controller : ScrollableList addCallback(CallbackListener) 
 controlP5.Controller : ScrollableList addListener(ControlListener) 
 controlP5.Controller : ScrollableList addListenerFor(int, CallbackListener) 
 controlP5.Controller : ScrollableList align(int, int, int, int) 
 controlP5.Controller : ScrollableList bringToFront() 
 controlP5.Controller : ScrollableList bringToFront(ControllerInterface) 
 controlP5.Controller : ScrollableList hide() 
 controlP5.Controller : ScrollableList linebreak() 
 controlP5.Controller : ScrollableList listen(boolean) 
 controlP5.Controller : ScrollableList lock() 
 controlP5.Controller : ScrollableList onChange(CallbackListener) 
 controlP5.Controller : ScrollableList onClick(CallbackListener) 
 controlP5.Controller : ScrollableList onDoublePress(CallbackListener) 
 controlP5.Controller : ScrollableList onDrag(CallbackListener) 
 controlP5.Controller : ScrollableList onDraw(ControllerView) 
 controlP5.Controller : ScrollableList onEndDrag(CallbackListener) 
 controlP5.Controller : ScrollableList onEnter(CallbackListener) 
 controlP5.Controller : ScrollableList onLeave(CallbackListener) 
 controlP5.Controller : ScrollableList onMove(CallbackListener) 
 controlP5.Controller : ScrollableList onPress(CallbackListener) 
 controlP5.Controller : ScrollableList onRelease(CallbackListener) 
 controlP5.Controller : ScrollableList onReleaseOutside(CallbackListener) 
 controlP5.Controller : ScrollableList onStartDrag(CallbackListener) 
 controlP5.Controller : ScrollableList onWheel(CallbackListener) 
 controlP5.Controller : ScrollableList plugTo(Object) 
 controlP5.Controller : ScrollableList plugTo(Object, String) 
 controlP5.Controller : ScrollableList plugTo(Object[]) 
 controlP5.Controller : ScrollableList plugTo(Object[], String) 
 controlP5.Controller : ScrollableList registerProperty(String) 
 controlP5.Controller : ScrollableList registerProperty(String, String) 
 controlP5.Controller : ScrollableList registerTooltip(String) 
 controlP5.Controller : ScrollableList removeBehavior() 
 controlP5.Controller : ScrollableList removeCallback() 
 controlP5.Controller : ScrollableList removeCallback(CallbackListener) 
 controlP5.Controller : ScrollableList removeListener(ControlListener) 
 controlP5.Controller : ScrollableList removeListenerFor(int, CallbackListener) 
 controlP5.Controller : ScrollableList removeListenersFor(int) 
 controlP5.Controller : ScrollableList removeProperty(String) 
 controlP5.Controller : ScrollableList removeProperty(String, String) 
 controlP5.Controller : ScrollableList setArrayValue(float[]) 
 controlP5.Controller : ScrollableList setArrayValue(int, float) 
 controlP5.Controller : ScrollableList setBehavior(ControlBehavior) 
 controlP5.Controller : ScrollableList setBroadcast(boolean) 
 controlP5.Controller : ScrollableList setCaptionLabel(String) 
 controlP5.Controller : ScrollableList setColor(CColor) 
 controlP5.Controller : ScrollableList setColorActive(int) 
 controlP5.Controller : ScrollableList setColorBackground(int) 
 controlP5.Controller : ScrollableList setColorCaptionLabel(int) 
 controlP5.Controller : ScrollableList setColorForeground(int) 
 controlP5.Controller : ScrollableList setColorLabel(int) 
 controlP5.Controller : ScrollableList setColorValue(int) 
 controlP5.Controller : ScrollableList setColorValueLabel(int) 
 controlP5.Controller : ScrollableList setDecimalPrecision(int) 
 controlP5.Controller : ScrollableList setDefaultValue(float) 
 controlP5.Controller : ScrollableList setHeight(int) 
 controlP5.Controller : ScrollableList setId(int) 
 controlP5.Controller : ScrollableList setImage(PImage) 
 controlP5.Controller : ScrollableList setImage(PImage, int) 
 controlP5.Controller : ScrollableList setImages(PImage, PImage, PImage) 
 controlP5.Controller : ScrollableList setImages(PImage, PImage, PImage, PImage) 
 controlP5.Controller : ScrollableList setLabel(String) 
 controlP5.Controller : ScrollableList setLabelVisible(boolean) 
 controlP5.Controller : ScrollableList setLock(boolean) 
 controlP5.Controller : ScrollableList setMax(float) 
 controlP5.Controller : ScrollableList setMin(float) 
 controlP5.Controller : ScrollableList setMouseOver(boolean) 
 controlP5.Controller : ScrollableList setMoveable(boolean) 
 controlP5.Controller : ScrollableList setPosition(float, float) 
 controlP5.Controller : ScrollableList setPosition(float[]) 
 controlP5.Controller : ScrollableList setSize(PImage) 
 controlP5.Controller : ScrollableList setSize(int, int) 
 controlP5.Controller : ScrollableList setStringValue(String) 
 controlP5.Controller : ScrollableList setUpdate(boolean) 
 controlP5.Controller : ScrollableList setValue(float) 
 controlP5.Controller : ScrollableList setValueLabel(String) 
 controlP5.Controller : ScrollableList setValueSelf(float) 
 controlP5.Controller : ScrollableList setView(ControllerView) 
 controlP5.Controller : ScrollableList setVisible(boolean) 
 controlP5.Controller : ScrollableList setWidth(int) 
 controlP5.Controller : ScrollableList show() 
 controlP5.Controller : ScrollableList unlock() 
 controlP5.Controller : ScrollableList unplugFrom(Object) 
 controlP5.Controller : ScrollableList unplugFrom(Object[]) 
 controlP5.Controller : ScrollableList unregisterTooltip() 
 controlP5.Controller : ScrollableList update() 
 controlP5.Controller : ScrollableList updateSize() 
 controlP5.Controller : String getAddress() 
 controlP5.Controller : String getInfo() 
 controlP5.Controller : String getName() 
 controlP5.Controller : String getStringValue() 
 controlP5.Controller : String toString() 
 controlP5.Controller : Tab getTab() 
 controlP5.Controller : boolean isActive() 
 controlP5.Controller : boolean isBroadcast() 
 controlP5.Controller : boolean isInside() 
 controlP5.Controller : boolean isLabelVisible() 
 controlP5.Controller : boolean isListening() 
 controlP5.Controller : boolean isLock() 
 controlP5.Controller : boolean isMouseOver() 
 controlP5.Controller : boolean isMousePressed() 
 controlP5.Controller : boolean isMoveable() 
 controlP5.Controller : boolean isUpdate() 
 controlP5.Controller : boolean isVisible() 
 controlP5.Controller : float getArrayValue(int) 
 controlP5.Controller : float getDefaultValue() 
 controlP5.Controller : float getMax() 
 controlP5.Controller : float getMin() 
 controlP5.Controller : float getValue() 
 controlP5.Controller : float[] getAbsolutePosition() 
 controlP5.Controller : float[] getArrayValue() 
 controlP5.Controller : float[] getPosition() 
 controlP5.Controller : int getDecimalPrecision() 
 controlP5.Controller : int getHeight() 
 controlP5.Controller : int getId() 
 controlP5.Controller : int getWidth() 
 controlP5.Controller : int listenerSize() 
 controlP5.Controller : void remove() 
 controlP5.Controller : void setView(ControllerView, int) 
 controlP5.ScrollableList : List getItems() 
 controlP5.ScrollableList : Map getItem(String) 
 controlP5.ScrollableList : Map getItem(int) 
 controlP5.ScrollableList : ScrollableList addItem(String, Object) 
 controlP5.ScrollableList : ScrollableList addItems(List) 
 controlP5.ScrollableList : ScrollableList addItems(Map) 
 controlP5.ScrollableList : ScrollableList addItems(String[]) 
 controlP5.ScrollableList : ScrollableList clear() 
 controlP5.ScrollableList : ScrollableList close() 
 controlP5.ScrollableList : ScrollableList open() 
 controlP5.ScrollableList : ScrollableList removeItem(String) 
 controlP5.ScrollableList : ScrollableList removeItems(List) 
 controlP5.ScrollableList : ScrollableList setBackgroundColor(int) 
 controlP5.ScrollableList : ScrollableList setBarHeight(int) 
 controlP5.ScrollableList : ScrollableList setBarVisible(boolean) 
 controlP5.ScrollableList : ScrollableList setItemHeight(int) 
 controlP5.ScrollableList : ScrollableList setItems(List) 
 controlP5.ScrollableList : ScrollableList setItems(Map) 
 controlP5.ScrollableList : ScrollableList setItems(String[]) 
 controlP5.ScrollableList : ScrollableList setOpen(boolean) 
 controlP5.ScrollableList : ScrollableList setScrollSensitivity(float) 
 controlP5.ScrollableList : ScrollableList setType(int) 
 controlP5.ScrollableList : boolean isBarVisible() 
 controlP5.ScrollableList : boolean isOpen() 
 controlP5.ScrollableList : int getBackgroundColor() 
 controlP5.ScrollableList : int getBarHeight() 
 controlP5.ScrollableList : int getHeight() 
 controlP5.ScrollableList : void controlEvent(ControlEvent) 
 controlP5.ScrollableList : void keyEvent(KeyEvent) 
 controlP5.ScrollableList : void setDirection(int) 
 controlP5.ScrollableList : void updateItemIndexOffset() 
 java.lang.Object : String toString() 
 java.lang.Object : boolean equals(Object) 

 created: 2015/03/24 12:21:22

 */
</code></pre>
]]></description>
   </item>
   <item>
      <title>Using ControlP5 in externel class</title>
      <link>https://forum.processing.org/two/discussion/17400/using-controlp5-in-externel-class</link>
      <pubDate>Sun, 03 Jul 2016 13:37:13 +0000</pubDate>
      <dc:creator>kucky</dc:creator>
      <guid isPermaLink="false">17400@/two/discussions</guid>
      <description><![CDATA[<p>Hey,
I use scrollablelist in extern class.</p>

<p>`
public class SerialConnect {</p>

<pre><code> PApplet pa;

 private ControlP5 cp5;

 Controller&lt;ScrollableList&gt; sbCOM;
</code></pre>

<p>//--------------------- End of Initialisatins and Deklarations --</p>

<pre><code>SerialConnect(PApplet _pa) {
    pa = _pa;
    cp5 = new ControlP5(pa);

    String[] portNames = SerialPortList.getPortNames();    
    sbCOM = cp5.addScrollableList("ComList");
    sbCOM.setCaptionLabel("COM Ports").setPosition(100, 0).
                                             setSize(80, 120).setBarHeight(BARHEIGHT).setItemHeight(20).
                                             addItems(portNames);

}   
//------------------------- end of constructor ------------ 
</code></pre>

<p>public void ComList(int value){</p>

<pre><code>    pa.println("Selectet is :"+ value);
    isCOMport = true;
        isConnect = InitSerial(selectedPort, current_BaudRate);

}//--------------------------- End of ComList() --

public void ControlEvent(ControlEvent theEvent) {

if (theEvent.isController()) {
        System.out.println("Something is happening.");
        if (theEvent.getName().matches("ComList")) {     
  }
}
}//--------------------------- End of ControlEvent() --
</code></pre>

<p>`
But i get no event. What am I doing wrong?
Gruß Willi</p>
]]></description>
   </item>
   <item>
      <title>Get id while hovering in scrollable list</title>
      <link>https://forum.processing.org/two/discussion/14800/get-id-while-hovering-in-scrollable-list</link>
      <pubDate>Sun, 07 Feb 2016 11:40:02 +0000</pubDate>
      <dc:creator>Per</dc:creator>
      <guid isPermaLink="false">14800@/two/discussions</guid>
      <description><![CDATA[<p>Is there a way of getting the individual id of scrollable list in controlP5 while hovering? In the sketch below you get the id by clicking. Possible to get it by hovering?</p>

<pre><code>import controlP5.*;
import java.util.*;

//String info;

ControlP5 cp5;

void setup() {
  size(400, 400);
  cp5 = new ControlP5(this);
  List l = Arrays.asList("a", "b", "c", "d", "e", "f", "g", "h");
  cp5.addScrollableList("dropdown")
    .setPosition(100, 100)
    .setSize(200, 100)
    .setBarHeight(20)
    .setItemHeight(20)
    .addItems(l)
    .setType(ScrollableList.LIST) // currently supported DROPDOWN and LIST
    .onMove(new CallbackListener() { 
    public void controlEvent(CallbackEvent theEvent) {
      float value = theEvent.getController().getValue();
      println("the value is " + value);
    }
  }
  );
}

void draw() {
  background(240);
  // HOVER
  boolean over = cp5.get(ScrollableList.class, "dropdown").isMouseOver();
  // println("OVER " + over);
}

void dropdown(int n) {
  println("id:" + n);
}
</code></pre>
]]></description>
   </item>
   <item>
      <title>controlP5 Font Size of items in ScrollableList</title>
      <link>https://forum.processing.org/two/discussion/16968/controlp5-font-size-of-items-in-scrollablelist</link>
      <pubDate>Fri, 03 Jun 2016 11:30:51 +0000</pubDate>
      <dc:creator>mala</dc:creator>
      <guid isPermaLink="false">16968@/two/discussions</guid>
      <description><![CDATA[<p>Does anyone know if it is possible to change the size of "item" text in scrollable lists ?</p>

<p>I can only find examples of changing the CaptionLabel .. i.e the header/name of your scrollable list, but not the size of the text for items within the list.
Hopefully i'm just missing an obvious solution to improve the legibility of these items in the list.</p>

<p>Cheers,
mala</p>
]]></description>
   </item>
   <item>
      <title>[controlP5]Two ScrollableLists</title>
      <link>https://forum.processing.org/two/discussion/16052/controlp5-two-scrollablelists</link>
      <pubDate>Sat, 16 Apr 2016 20:43:52 +0000</pubDate>
      <dc:creator>eduzal</dc:creator>
      <guid isPermaLink="false">16052@/two/discussions</guid>
      <description><![CDATA[<p>Hi. I'm in a project that involves two scrollableLists.
I need the result of the first list to determine what will the results of the second one will be.
the full congressmen list in on a cvs file, with name, party,origin state and vote status.</p>

<p>actually. i'm doing a parliamentary vote map. so the first sL is a state lists(27 states). the second scrollable list should be the state congressmen. so if i choose state 6 on the first, it should list all that state's congressmen on the second sL.
actually i can retrieve all the data from the table and read it correctly with a state filter. what i cannot do is add these names to the second list.</p>

<p>how can  do that?</p>

<p>void setup(){</p>

<pre><code>    cp5 = new ControlP5(this);

        cp5.addScrollableList("dropdown")
          .setPosition(20, 40)
            .setCaptionLabel("ESTADO")
              .setSize(60, 200)
                .setItemHeight(25)
                  .setBarHeight(30)
                    .addItems(estado)
                      .setType(ScrollableList.LIST)
                        ;


        cp5.addScrollableList("dropdown2")
          .setPosition(100, 40)
            .setCaptionLabel("DEPUTADO")
              .setSize(300, 150)
                .setItemHeight(25)
                  .setBarHeight(30)
                      .setType(ScrollableList.LIST)
                        ;
   }

     void dropdown(int n) {
        String estado=cp5.get(ScrollableList.class, "dropdown").getItem(n).get("name").toString();
        println(estado);

        cp5.get(ScrollableList.class, "dropdown2").clear();

        for (TableRow row : table.findRows (estado, "estado")) {
          int depId=row.getInt("id");   
          String depNome=row.getString("nome");
          String depEstado=row.getString("estado");
          String depPartido=row.getString("partido");
          println(depId + " " + depNome + ": " + depEstado+"|"+depPartido);

        }
       // cp5.get(ScrollableList.class,"dropdown2").addItems(nomes);
      }
</code></pre>
]]></description>
   </item>
   <item>
      <title>Question about ControlP5 library</title>
      <link>https://forum.processing.org/two/discussion/15740/question-about-controlp5-library</link>
      <pubDate>Tue, 29 Mar 2016 07:33:56 +0000</pubDate>
      <dc:creator>Daantje</dc:creator>
      <guid isPermaLink="false">15740@/two/discussions</guid>
      <description><![CDATA[<p>Hello, I have questions about the ControlP5 library. Yesterday, I've found this library with a scrollable list example:</p>

<pre><code>import controlP5.*;

import java.util.*;

String[] listItems = new String[5];

ControlP5 cp5;

void setup() {

  size(400, 400);

  surface.setResizable(true);

  listItems[0] = "5130";

  listItems[1] = "5131";

  listItems[2] = "5150";

  listItems[3] = "5170";

  listItems[4] = "9591";

  cp5 = new ControlP5(this);

  List l = Arrays.asList(listItems);

  /* add a ScrollableList, by default it behaves like a DropdownList */

  cp5.addScrollableList("dropdown")

     .setPosition(10, 10)

     .setSize(width-20, height-20)

     .setBarHeight(50)

     .setItemHeight(20)

     .addItems(l)

     .setType(ScrollableList.LIST) // currently supported DROPDOWN and LIST

;    

}

void draw() {

  background(240);

}

void dropdown(int n) {

  CColor c = new CColor();

  c.setBackground(color(255,0,0));

  cp5.get(ScrollableList.class, "dropdown").getItem(n).put("color", c);

}
</code></pre>

<p>(I've removed some code from the example which was un-necessary for me)
Now, I have this questions:</p>

<ol>
<li>How can I change the cp5.setSize in my loop? As you can see, the sketch size is resizable, but if I change the size of the program, the list size won't change.</li>
<li>How can you set the colors of the list text? I have a very light background, so I need black text in my list. Is this possible?</li>
<li>Is it possible to let the user also unselect items? In this example code, there is no option.</li>
</ol>

<p>Thanks in advance,
Daantje</p>
]]></description>
   </item>
   <item>
      <title>two buttons in the same place that act like a switch.</title>
      <link>https://forum.processing.org/two/discussion/15054/two-buttons-in-the-same-place-that-act-like-a-switch</link>
      <pubDate>Mon, 22 Feb 2016 08:20:12 +0000</pubDate>
      <dc:creator>vangalvin</dc:creator>
      <guid isPermaLink="false">15054@/two/discussions</guid>
      <description><![CDATA[<p>I am trying to build a login interface for an arduino that has several sensors, I was trying to create a button that would allow me to record and log to file and when clicked the button would become hidden run the associated code then the STOP button would become visible. Once that is clicked the logging would stop, hide the button and bring the REC button to the front.</p>

<p>The code kind of works but I am getting a bunch of errors.
Here is a copy of what I have so far.</p>

<pre>`
import controlP5.*;
import java.util.*;


ControlP5 cp5;

Chart myChart1;
Chart myChart2;
Chart myChart3;
Chart myChart4;

Button b1;
Button b2;

Textlabel b1Lbl;
boolean logging = false;
String bevent;

void setup() {
  size(800, 600);
  cp5 = new ControlP5(this);
  
  List l = Arrays.asList("a", "b", "c", "d", "e", "f", "g", "h");
  /* add a ScrollableList, by default it behaves like a DropdownList */
  cp5.addScrollableList("SELECT COM PORT")
     .setPosition(10, 10)
     .setSize(200, 100)
     .setBarHeight(20)
     .setItemHeight(20)
     .addItems(l)
     .close()
     // .setType(ScrollableList.LIST) // currently supported DROPDOWN and LIST
     ;
  // create a new button with name 'REC'
  b1 = cp5.addButton("REC")
     .setValue(0)
     .setPosition(740,10)
     .setSize(50,20)
//     .setLabel("REC")
     .setVisible(true)
     ;
     
  b2 = cp5.addButton("STOP")
     .setValue(0)
     .setPosition(740,10)
     .setSize(50,20)
//     .setLabel("STOP")
     .setVisible(false)
     ;
     
  myChart1 = cp5.addChart("sensor1")
     .setPosition(10, 40)
     .setSize(385, 200)
     .setRange(-10, 120)
     .setView(Chart.LINE) // use Chart.LINE, Chart.PIE, Chart.AREA, Chart.BAR_CENTERED
     .setStrokeWeight(1.5)
     .setColorCaptionLabel(color(40))
     .setLabel("")
     ;

//  myChart1.addDataSet("sensin1");
//  myChart1.setData("sensein1", new float[100]);

  myChart2 = cp5.addChart("sensor2")
     .setPosition(405, 40)
     .setSize(385, 200)
     .setRange(-10, 120)
     .setView(Chart.LINE) // use Chart.LINE, Chart.PIE, Chart.AREA, Chart.BAR_CENTERED
     .setStrokeWeight(1.5)
     .setColorCaptionLabel(color(40))
     .setLabel("")
     ;

//  myChart2.addDataSet("sensin2");
//  myChart2.setData("sensin2", new float[100]);

  myChart3 = cp5.addChart("sensor3")
     .setPosition(10, 250)
     .setSize(385, 200)
     .setRange(-10, 120)
     .setView(Chart.LINE) // use Chart.LINE, Chart.PIE, Chart.AREA, Chart.BAR_CENTERED
     .setStrokeWeight(1.5)
     .setColorCaptionLabel(color(40))
     .setLabel("")
     ;

//  myChart3.addDataSet("sensin3");
//  myChart3.setData("sensein3", new float[100]);

  myChart4 = cp5.addChart("sensor4")
     .setPosition(405, 250)
     .setSize(385, 200)
     .setRange(-10, 120)
     .setView(Chart.LINE) // use Chart.LINE, Chart.PIE, Chart.AREA, Chart.BAR_CENTERED
     .setStrokeWeight(1.5)
     .setColorCaptionLabel(color(40))
     .setLabel("")
     ;

//  myChart4.addDataSet("sensin4");
//  myChart4.setData("sensin4", new float[100]);
}

void draw() {
  background(240);
}

public void REC(){
  b1.hide();
  b2.show();
  b2.bringToFront();
  logging = true;
  println("Logging Data to File");
}

public void STOP(){
  b2.hide();
  b1.show();
  b1.bringToFront();
  logging = false;
  println("Stop Logging Data");
}

void dropdown(int n) {
  /* request the selected item based on index n */
  println(n, cp5.get(ScrollableList.class, "dropdown").getItem(n));
  
  /* here an item is stored as a Map  with the following key-value pairs:
   * name, the given name of the item
   * text, the given text of the item by default the same as name
   * value, the given value of the item, can be changed by using .getItem(n).put("value", "abc"); a value here is of type Object therefore can be anything
   * color, the given color of the item, how to change, see below
   * view, a customizable view, is of type CDrawable 
   */
  
   CColor c = new CColor();
  c.setBackground(color(255,0,0));
  cp5.get(ScrollableList.class, "dropdown").getItem(n).put("color", c);
  
}

void keyPressed() {
  switch(key) {
    case('1'):
    /* make the ScrollableList behave like a ListBox */
    cp5.get(ScrollableList.class, "dropdown").setType(ControlP5.LIST);
    break;
    case('2'):
    /* make the ScrollableList behave like a DropdownList */
    cp5.get(ScrollableList.class, "dropdown").setType(ControlP5.DROPDOWN);
    break;
    case('3'):
    /*change content of the ScrollableList */
    List l = Arrays.asList("a-1", "b-1", "c-1", "d-1", "e-1", "f-1", "g-1", "h-1", "i-1", "j-1", "k-1");
    cp5.get(ScrollableList.class, "dropdown").setItems(l);
    break;
    case('4'):
    /* remove an item from the ScrollableList */
    cp5.get(ScrollableList.class, "dropdown").removeItem("k-1");
    break;
    case('5'):
    /* clear the ScrollableList */
    cp5.get(ScrollableList.class, "dropdown").clear();
    break;
  }
}`
</pre>

<p>The errors I am getting are as follows...</p>

<pre>
Feb 22, 2016 9:16:32 PM controlP5.ControlBroadcaster printMethodError
SEVERE: An error occured while forwarding a Controller event, please check your code at REC
java.lang.reflect.InvocationTargetException
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at controlP5.ControlBroadcaster.invokeMethod(Unknown Source)
    at controlP5.ControlBroadcaster.callTarget(Unknown Source)
    at controlP5.ControlBroadcaster.broadcast(Unknown Source)
    at controlP5.Controller.broadcast(Unknown Source)
    at controlP5.Button.setValue(Unknown Source)
    at TemperatureGUI_001.setup(TemperatureGUI_001.java:67)
    at processing.core.PApplet.handleDraw(PApplet.java:2377)
    at processing.awt.PSurfaceAWT$12.callDraw(PSurfaceAWT.java:1527)
    at processing.core.PSurfaceNone$AnimationThread.run(PSurfaceNone.java:316)
Caused by: java.lang.NullPointerException
    at TemperatureGUI_001.REC(TemperatureGUI_001.java:140)
    ... 13 more
Feb 22, 2016 9:16:32 PM controlP5.ControlBroadcaster printMethodError
SEVERE: An error occured while forwarding a Controller event, please check your code at STOP
java.lang.reflect.InvocationTargetException
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at controlP5.ControlBroadcaster.invokeMethod(Unknown Source)
    at controlP5.ControlBroadcaster.callTarget(Unknown Source)
    at controlP5.ControlBroadcaster.broadcast(Unknown Source)
    at controlP5.Controller.broadcast(Unknown Source)
    at controlP5.Button.setValue(Unknown Source)
    at TemperatureGUI_001.setup(TemperatureGUI_001.java:75)
    at processing.core.PApplet.handleDraw(PApplet.java:2377)
    at processing.awt.PSurfaceAWT$12.callDraw(PSurfaceAWT.java:1527)
    at processing.core.PSurfaceNone$AnimationThread.run(PSurfaceNone.java:316)
Caused by: java.lang.NullPointerException
    at TemperatureGUI_001.STOP(TemperatureGUI_001.java:148)
    ... 13 more
</pre>

<p>The unusual thing is that the code actually seems to work and the button acts the way I would have expected it but would rather not have the errors.</p>
]]></description>
   </item>
   <item>
      <title>Sending a number through serial to arduino with ControlListener(library controlP5)</title>
      <link>https://forum.processing.org/two/discussion/14617/sending-a-number-through-serial-to-arduino-with-controllistener-library-controlp5</link>
      <pubDate>Mon, 25 Jan 2016 21:06:36 +0000</pubDate>
      <dc:creator>luisandresgonzalez</dc:creator>
      <guid isPermaLink="false">14617@/two/discussions</guid>
      <description><![CDATA[<p>I'm trying to send a number to an arduino through controlListener that monitors a dropdown menu.</p>

<p>Here's the code:</p>

<pre>
class MyControlListener implements ControlListener {
  int mode ;
  public void controlEvent(ControlEvent theEvent) {

    println((int)theEvent.getController().getValue()+1);  //debug
    mode = (int)theEvent.getController().getValue()+1;
     
    myPort.write(mode);
     
  }
}
</pre>

<p>The problem is that apparently, arduino doesn't receive the appropriate data type because when I check what it has received it shows a blank space. If I press the number with the keyboard it receives it ok. Here's an attempt to use the menu and with the keyboard:</p>

<pre>
ControlP5 2.2.5 infos, comments, questions at <a href="http://www.sojamo.de/libraries/controlP5" target="_blank" rel="nofollow">http://www.sojamo.de/libraries/controlP5</a>
Enter Test mode:
Press 1 for random mode
Press 2 for fixed time mode
2
I received:
Invalid optionI received: 2
Game mode selected = Fixed time mode

</pre>

<p>Here is the complete code:</p>

<pre>
/** 
 REACTION TIME GAME v 1.0
 Adapted by code made by Elaine Laguerta  
 by Luis Andrés Gonzalez, January 2016
 
 Reads reaction time from Arduino over the serial port and save it to .csv file on your computer.
 The .csv file will be saved in the same folder as your Processing sketch.
 This sketch assumes that values read in seconds by Arduino are separated by a newline character.
 Special code numbers are specified to signal the game start, success and failure of accomplishing the task. 
 Each reading will have it's own row and timestamp in the resulting csv file. This sketch will write a new file each day.   
 
 The hardware:
 * A pushbutton connected to Arduino input pins
 * Arduino connected to computer via USB cord
 
 The software:
 *Arduino IDE
 *Processing (download the Processing software here: <a href="https://www.processing.org/download/" target="_blank" rel="nofollow">https://www.processing.org/download/</a>
 *The corresponding arduino code
 
 */

// ==== Libraries and instantiations ==== 
import processing.serial.*;
Serial myPort; //creates a software serial port on which you will listen to Arduino

import ddf.minim.*;
import ddf.minim.ugens.*;
Minim minim;
AudioOutput out;

import controlP5.*;
import java.util.*;

ControlP5 cp5;
MyControlListener myListener;

Table table; //table where we will read in and store values. You can name it something more creative!

int numReadings = 1; //keeps track of how many readings you'd like to take before writing the file. 
int readingCounter = 0; //counts each reading to compare to numReadings. 

// Serial code numbers for specific events
int startCode = 9090; // code for game start
int earlyCode = 1010; // code for early button press
int lateCode = 7777; // code for late button press
String fillColor;
char letter;
String fileName;
String words;
boolean startLogging;


void setup() {
  size(500, 700);
  String portName = Serial.list()[1]; 
  //CAUTION: your Arduino port number is probably different! Mine happened to be 1. Use a "handshake" sketch to figure out and test which port number your Arduino is talking on. A "handshake" establishes that Arduino and Processing are listening/talking on the same port.
  //Here's a link to a basic handshake tutorial: <a href="https://processing.org/tutorials/overview/" target="_blank" rel="nofollow">https://processing.org/tutorials/overview/</a>

  // SOUND setup:
  minim = new Minim(this);
  out = minim.getLineOut();
  out.setTempo( 80 );
  out.pauseNotes();
  // end SOUND setup.

  myPort = new Serial(this, portName, 9600); //set up your port to listen to the serial port

  table = new Table(); 
  table.addColumn("id"); //This column stores a unique identifier for each record. We will just count up from 0 - so your first reading will be ID 0, your second will be ID 1, etc. 

  //the following adds columns for time. You can also add milliseconds. See the Time/Date functions for Processing: <a href="https://www.processing.org/reference/" target="_blank" rel="nofollow">https://www.processing.org/reference/</a> 
  table.addColumn("year");
  table.addColumn("month");
  table.addColumn("day");
  table.addColumn("hour");
  table.addColumn("minute");
  table.addColumn("second");

  //the following are dummy columns for each data value. Add as many columns as you have data values. Customize the names as needed. Make sure they are in the same order as the order that Arduino is sending them!
  table.addColumn("sensor1");

  cp5 = new ControlP5(this);
  List modes = Arrays.asList("Random time mode", "Fixed time mode");
  /** add a ScrollableList, by default it behaves like a DropdownList */
  cp5.addScrollableList("Select session mode")
    .setPosition(200, 50)
    .setSize(250, 100)
    .setBarHeight(20)
    .setItemHeight(20)
    .addItems(modes)
    .setType(ScrollableList.DROPDOWN) // currently supported DROPDOWN and LIST
    ;
  myListener = new MyControlListener();
  cp5.getController("Select session mode").addListener(myListener);
} // void setup

void serialEvent(Serial myPort) {

  String val = myPort.readStringUntil('\n'); //The newline separator separates each Arduino loop. We will parse the data by each newline separator. 

  if (val!= null) { //We have a reading! Record it.

    val = trim(val); //gets rid of any whitespace or Unicode nonbreakable space
    float sensorVal = float(val); //parses the packet from Arduino and places the valeus into the sensorVals array. I am assuming floats. Change the data type to match the datatype coming from Arduino.
    if (sensorVal == 0000) {
      println("Logging started");
      startLogging = true;
    }
    if (float(val) == startCode) {
      out.playNote( 0.0, 0.4, "C3" );
      out.playNote( 0.2, 0.2, "C4" );
      out.resumeNotes();
      fillColor="green";
    } else if (float(val) == earlyCode) {
      println("You pressed the button too early!");
      fillColor="red";
      out.playNote( 0, 2, "A1");
      out.resumeNotes();
    } else if (float(val) == lateCode) {
      println("You pressed the button too late!");
      fillColor="red";
      out.playNote( 0, 2, "A1");
      out.resumeNotes();
    } else if (!Float.isNaN(sensorVal)){
      print("Your reaction time was: ");
      println(val); 
      out.playNote( 0, 0.2, "C4");
      out.playNote( 0.2, 0.2, "C4");
      out.playNote( 0.4, 0.2, "C4");
      out.resumeNotes();
      fillColor="yellow";
    } else {
      println(val);
    }



    if (sensorVal != startCode &amp;&amp; !Float.isNaN(sensorVal) ) { // if it's NOT the start number but it IS a number
    //if (sensorVal != startCode &amp;&amp; startLogging == true) { // if it's NOT the start number but it IS a number
      TableRow newRow = table.addRow(); //add a row for this new reading
      newRow.setInt("id", table.lastRowIndex());//record a unique identifier (the row's index)

      //record time stamp
      newRow.setInt("year", year());
      newRow.setInt("month", month());
      newRow.setInt("day", day());
      newRow.setInt("hour", hour());
      newRow.setInt("minute", minute());
      newRow.setInt("second", second());

      //record sensor information. Customize the names so they match your sensor column names. 

      if (sensorVal == earlyCode) {
        newRow.setString("sensor1", "early");
      } else if (sensorVal == lateCode) {
        newRow.setString("sensor1", "late");
      } else if (Float.isNaN(sensorVal)) {
        // if its not a number, don't log it
      } else {
        newRow.setFloat("sensor1", sensorVal);
      }

      readingCounter++; //optional, use if you'd like to write your file every numReadings reading cycles
    }
    //saves the table as a csv in the same folder as the sketch every numReadings. 
    if (readingCounter % numReadings ==0) {//The % is a modulus, a math operator that signifies remainder after division. The if statement checks if readingCounter is a multiple of numReadings (the remainder of readingCounter/numReadings is 0)
      fileName = "data/" + str(year()) + str(month()) + str(day()) /**+" - " + str(table.lastRowIndex())*/ + ".csv"; //this filename is of the form year+month+day+readingCounter
      saveTable(table, fileName); //Woo! save it to your computer. It is ready for all your spreadsheet dreams.
    }
  }
} // void serialevent


void draw()
{  
  if (fillColor == "red") {              // If the serial value is 0,
    fill(255, 0, 0);                   // set fill to black
  } else if (fillColor == "green") {                       // If the serial value is not 0,
    fill(0, 255, 0);                 // set fill to light gray
  } else if (fillColor =="yellow") {
    fill(255, 255, 0);
  }
  background(240);
  rect(50, 50, 99, 99);
}

void keyTyped() {
  // The variable "key" always contains the value 
  // of the most recent key pressed.
  if ((key &gt;= '0' &amp;&amp; key </pre>
]]></description>
   </item>
   <item>
      <title>control p5: How to access "name" or "text" property in ScrollableList?</title>
      <link>https://forum.processing.org/two/discussion/13495/control-p5-how-to-access-name-or-text-property-in-scrollablelist</link>
      <pubDate>Thu, 12 Nov 2015 09:55:03 +0000</pubDate>
      <dc:creator>Andreas_Ref</dc:creator>
      <guid isPermaLink="false">13495@/two/discussions</guid>
      <description><![CDATA[<p>Hi, I have a simple question about ScrollableLists in controlP5.</p>

<p>I want to acces the "name" or "text" behind the items in a ScrollableLists.</p>

<p>How do I access them, and for instance set a string (in code below named "selected") equal to the value of the item on the list that is selected?</p>

<pre><code>import controlP5.*;
import java.util.*;

ControlP5 cp5;

String selected = "";

void setup() {
  size(400, 400);
  cp5 = new ControlP5(this);
  List l = Arrays.asList("a", "b", "c", "d", "e", "f", "g", "h");
  cp5.addScrollableList("dropdown")
     .setPosition(100, 100)
     .setSize(200, 100)
     .setBarHeight(20)
     .setItemHeight(20)
     .addItems(l)
     ;
}

void draw() {
  background(120);
  text("You have selected: " + selected, 100, 300);
}
</code></pre>
]]></description>
   </item>
   </channel>
</rss>