Help with controlP5 library

Using the controlP5 library, I’m having trouble.
I get this error message:

Aug 10, 2019 7:53:24 AM controlP5.ControlBroadcaster printMethodError
SEVERE: An error occured while forwarding a Controller event, please check your code at controlEvent

With this code:

import controlP5.*;

ControlP5 cp5;

String textoBusqueda = "";
Client cliente;

void setup() {
  size(600, 100);
  cp5 = new ControlP5(this);
  cp5.addTextfield("en que pensas?")
     .setPosition(150, 30)
   cliente = new Client(this, "", 8085);


void draw() {

void controlEvent(ControlEvent theEvent) {
  if(theEvent.isAssignableFrom(Textfield.class)) {
          if(textoBusqueda != "" && key==ENTER){
              cliente.write(textoBusqueda); // codigo para envio datos al servidor
              textoBusqueda = "";
1 Like

I’m sorry, I’ve no idea about the error you write about, but here’s another suggestion:

textoBusqueda != “”

is not the way to compare Strings. It is



1 Like

Or !"".equals(textoBusqueda), which is much safer than !textoBusqueda.equals("") and even textoBusqueda.isEmpty(); b/c it’s impervious to textoBusqueda being null. :nerd_face:

1 Like

Thanks for the advice, I’m still looking for the solution about the problem with the library