Using ControlP5 in externel class

edited July 2016 in Library Questions

Hey, I use scrollablelist in extern class.

` public class SerialConnect {

 PApplet pa;

 private ControlP5 cp5;

 Controller<ScrollableList> sbCOM;

//--------------------- End of Initialisatins and Deklarations --

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 ------------ 

public void ComList(int value){

    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() --

` But i get no event. What am I doing wrong? Gruß Willi

Answers

Sign In or Register to comment.