We are about to switch to a new forum software. Until then we have removed the registration on this forum.
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
Callback is controlEvent() w/ lowerCamelCase name; not ControlEvent()! L-)
And it's only recognizable as a PApplet method in the main sketch. :-SS
Thanks for the quick response, but i don't understand this comment. "And it's only recognizable as a PApplet method in the main sketch. " Can i use controlp5 elements only in the main sketch? Can you correct my code, please? If you have time and pleasure. 8-|
cp5 = new ControlP5(pa);
BtW, you need to learn how to properly post code in the forum: :-\"
https://forum.Processing.org/two/discussion/15473/readme-how-to-format-code-and-text
Ok thanks. I will try and learn it.
It works. ;) =D> =D>