We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpOther Libraries › controlP5 textfield in tab of external control win
Page Index Toggle Pages: 1
controlP5 textfield in tab of external control win (Read 858 times)
controlP5 textfield in tab of external control win
Dec 20th, 2008, 5:07pm
 
Hi

I recently crossed a problem with the controlP5 library. I try to use textfields in order do some settings inside of a tab inside of an external control window. unfortunatly I am unable to change the values of the textfields, nor am I able to cause any control event - eventhough they seem to cause events when they are initialized (see output window) - strange enough.

here is the (shortened) code of my problem.

Code:

import controlP5.*;

private ControlP5 controlP5;
private ControlWindow controlWindow;

private static String RADIO_NAME_LISTEN = "Listen";
private static String BUTTON_NAME_CONNECTOSC = "Connect";
private static String BUTTON_NAME_ACTIVATENATEBU = "Activate";
private static String BUTTON_NAME_CLEAR = "Clear";
private static String BUTTON_NAME_REFRESH = "Refresh";

private static String TEXT_NAME_OSCSERVERURL = "osc Server";
private static String TEXT_NAME_OSCSERVERPORT = "osc Server Port";
private static String TEXT_NAME_OSCLISTENERPORT = "osc Listener Port";

private static String TEXTAREA_NAME_PX1M0D_INPUTWIN = "px1m0dInputWin";
private static String TEXTAREA_NAME_PX1M0D_OUTPUTWIN = "px1m0dOutputWin";
private static String TEXTAREA_NAME_WORLD_INPUTWIN = "worldInputWin";
private static String TEXTAREA_NAME_WORLD_OUTPUTWIN = "worldOutputWin";

private Textarea px1m0dInput, px1m0dOutput, worldInput, worldOutput;

private static String TAB_MESSAGE = "Messages";
private static String TAB_SETTING = "Settings";

private String px1m0dOutputMessage = "";
private String worldOutputMessage = "";
private String px1m0dInputMessage = "";
private String worldInputMessage = "";

private Textfield oscServerUrl;
private Textfield oscServerPort;
private Textfield oscListenerPort;


int myColorBackground = color(0,0,0);

int sliderValue = 100;

void setup() {
size(400,400);
frameRate(30);
controlP5 = new ControlP5(this);
controlP5.setAutoDraw(false);
controlWindow = controlP5.addControlWindow("controlP5window",100,100,400,300);
controlWindow.setBackground(color(40));

Tab messageTab = controlP5.addTab(controlWindow, TAB_MESSAGE);

Tab settingTab = controlWindow.currentTab();
settingTab.setLabel(TAB_SETTING);

/** creates content of the "setting tab"
*/

System.out.println("adding textfields...");
oscServerUrl = controlP5.addTextfield(TEXT_NAME_OSCSERVERURL,10,20,140,20);
oscServerUrl.moveTo(settingTab);
oscServerUrl.setValue("127.0.0.1");

oscServerPort = controlP5.addTextfield(TEXT_NAME_OSCSERVERPORT,160,20,40,20);
oscServerPort.moveTo(settingTab);
oscServerPort.setValue("12000");

oscListenerPort = controlP5.addTextfield(TEXT_NAME_OSCLISTENERPORT,250,20,40,20);
oscListenerPort.moveTo(settingTab);
oscListenerPort.setValue("12002");

controlP5.Button button2 = controlP5.addButton(BUTTON_NAME_CONNECTOSC,100,340,20,50,20);
button2.moveTo(settingTab);
System.out.println("...adding textfields finished");


/** creates content of the "message tab" -> is not really of concern here
*/

Radio r = controlP5.addRadio(RADIO_NAME_LISTEN,140, 5);
r.addItem("off", 0);
r.addItem("on", 1);
r.moveTo(controlWindow);
r.setTab(TAB_MESSAGE);

controlP5.Button button3 = controlP5.addButton(BUTTON_NAME_CLEAR,100,200,5,50,10);
button3.moveTo(messageTab);

Textlabel tlabel = controlP5.addTextlabel("label1", "Px1m0d input messages", 10, 22);
tlabel.moveTo(messageTab);
px1m0dInput = controlP5.addTextarea(TEXTAREA_NAME_PX1M0D_INPUTWIN, "waiting for input ....\n",10,30,180,20);
px1m0dInput.setColor(0xff00ddff);
px1m0dInput.moveTo(messageTab, controlWindow);
tlabel = controlP5.addTextlabel("label2", "Px1m0d output messages", 190, 22);
tlabel.moveTo(messageTab);
px1m0dOutput = controlP5.addTextarea(TEXTAREA_NAME_PX1M0D_OUTPUTWIN, "waiting for output ...\n",200,30,180,120);
px1m0dOutput.setColor(0xff00ffdd);
px1m0dOutput.moveTo(messageTab, controlWindow);
tlabel = controlP5.addTextlabel("label3", "World input messages", 10, 152);
tlabel.moveTo(messageTab);
worldInput = controlP5.addTextarea(TEXTAREA_NAME_WORLD_INPUTWIN, "waiting for input ...\n",10,160,180,120);
worldInput.setColor(0xff00eeff);
worldInput.moveTo(messageTab, controlWindow);
tlabel = controlP5.addTextlabel("label4", "World output messages", 190, 152);
tlabel.moveTo(messageTab);
worldOutput = controlP5.addTextarea(TEXTAREA_NAME_WORLD_OUTPUTWIN, "waiting for output ...\n",200,160,180,120);
worldOutput.setColor(0xff00ffee);
worldOutput.moveTo(messageTab, controlWindow);
}

void draw() {
background(myColorBackground);
fill(sliderValue);
rect(0,0,width,100);
}


void controlEvent(ControlEvent theControlEvent) {
if(theControlEvent.isController()) {
println("controller : "+theControlEvent.controller().id());
}
else if (theControlEvent.isTab()) {
println("tab : "+theControlEvent.tab().id()+" / "+theControlEvent.tab().name());
}
}



it runs in processing 1.0, I am using the latest library version (0.3.6)

any hints or suggestions would be greatly appreciated

cheers

martin
Re: controlP5 textfield in tab of external control
Reply #1 - Feb 16th, 2009, 8:36am
 
Hi there - I'm having this problem too. I noticed that at http://processing.org/discourse/yabb_beta/YaBB.cgi?board=os_libraries_tools;action=display;num=1163646039;start=86#86 there has been some discussion of this problem, and it was mentioned that this was being looked into, but that was many months ago now. Has there been more progress on this? It seems like a pretty vital feature for the use of control windows. Any status updates would be greatly appreciated. Thanks.
Page Index Toggle Pages: 1