The function enableCollapse() does not exist

Hello All,

First time user of Processing and stuck on a script I obtained from github Link. I cut down the script to shorten it for here, so hope I didn’t cut off too much:

import controlP5.*;
import processing.serial.*;

/*Initialization of variables*/
Serial myPort;
String val; //store data received in the serial port
boolean firstContact = false;  //is false while Processing isn't connected to Arduino
ControlP5 cp5; //cp5 printer for GUI
DropdownList ddlCom,ddlGain,ddlSr; //DDL Drop Down List objtects

PFont fontTit = createFont("arial",20);
PFont fontTex = createFont("arial",12);
PFont fontTexMini = createFont("arial",10);

Textfield status; //Text field for notifications to the user

int myColorBackground = 255; //Default Background

int state=1; //1-Conf. connection 2-Conf. acquisition 3-Ready for data acquisition 4-Acquiring data 5-Reciving file 7-File Recived

OutputStream OutputFileRecived; //Writer for file received over serial port
  
byte [] FileBuffer=new byte[0];

String folder=null; //Folder when the file downloaded from Arduino will be saved

String overwriteFile="N"; //When selected name already exist, user can overwrite it. By default, N=false.

/* Variables progress bar */
int count=0;
int ini=0;
Integer duration=0;
Integer tamFile=0;
/* End variables progress bar */

void setup() {
  size(800,500); //Window size
  
   
  cp5 = new ControlP5(this);
   // Print Status bar
  cp5.addTextlabel("textWarnings").setText("Current status: ")
  .setPosition(50,470).setColorValue(0).setFont(fontTex);

   status = ((Textfield)cp5.getController("Status"));
   status.setValue("Welcome Geophonino configuration");
  
  ddlCom = cp5.addDropdownList("serial").setPosition(270, 75);
  for (int i = 0; i < Serial.list().length; i = i+1) {
    ddlCom.addItem(Serial.list()[i], i+1); 
  }
  if (Serial.list().length==0)
  {
     status.setValue("Error, COM Port not detected, connect Geophonino and press CONNECT... button.");
  }
  customizeDl(ddlCom);
}

void customizeDl(DropdownList ddl) {
  // Format DropDownList
  ddl.enableCollapse();
  ddl.setBackgroundColor(color(190));
  ddl.actAsPulldownMenu(true);
  ddl.setItemHeight(20);
  ddl.setBarHeight(15);
  ddl.captionLabel().style().marginTop = 3;
  ddl.captionLabel().style().marginLeft = 3;
  ddl.valueLabel().style().marginTop = 10;
  ddl.setColorBackground(color(200, 200, 200));
  ddl.setColorActive(color(0, 128));
  ddl.setColorLabel(color(0,0,0));
}

The script should work as it has been tested by others but gives a general error ‘The function enableCollapse() does not exist’. Any ideas what I’m doing wrong?

1 Like

As you can see developer mentioned -

  • ColorWheel a color wheel picker, use the arrow on the left to change saturation ControlP5colorWheel
  • DropdownList (use ScrollableList instead)
  • Group for grouping and nesting controllers ControlP5group
  • Icon adds Icon support, an Icon behaves like a Button or Toggle ControlP5icon
  • ListBox (use ScrollableList instead)
1 Like

Thanks! You saved my day

Hola, Amigo como lograste corregir el error?, Tengo el mismo archivo pero me sigue dando error

@raysoduran – La solución es la dada por @black. Probablemente esté usando una de las funciones en esa lista, y en su lugar debería usar una función diferente (por ejemplo, ScrollableList). Pero si aún tiene un problema, debe decir más sobre su problema en una nueva discusión separada.