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.
Pages: 1 ... 9 10 11 12 13 ... 17
controlP5 (Read 126745 times)
Re: controlP5
Reply #150 - Feb 28th, 2009, 8:55am
 
Awesome! Thanks!
Re: controlP5
Reply #151 - Mar 5th, 2009, 8:51pm
 
I'm having a problem getting ControlP5 to work with PeasyCam.  I can't get the GUI to stay on top and not move with the camera.  I've tried hint(DISABLE_DEPTH_TEST); around ControlP5 but it still moves around.  Any help would be greatly appreciated.

- jeff
Re: controlP5
Reply #152 - Mar 19th, 2009, 3:43pm
 
I have a controller question which maybe someone can help: I want two to program two textfields that work 'complementary' to each other -- so if the user types (for example) '0.75' into one of the fields, then the other field will automatically update to '0.25' (= 1 - 0.75).

I wondered what this type of functionality is called -- I suppose there is a standard logic for doing it. And does controlP5 have the right methods for setting up such textfields?
Re: controlP5
Reply #153 - Mar 20th, 2009, 11:52am
 
hi phillip, does this help?

Quote:
import controlP5.*;
ControlP5 controlP5;

Textfield myTextfieldA;
Textfield myTextfieldB;

void setup() {
 size(400,400);
 frameRate(25);
 controlP5 = new ControlP5(this);
 
 myTextfieldA = controlP5.addTextfield("textA",100,160,200,20);
 myTextfieldA.setAutoClear(false);

 myTextfieldB = controlP5.addTextfield("textB",100,200,200,20);
 myTextfieldB.setAutoClear(false);
}

void draw() {
 background(0);
}

public void textA(String theText) {
 changeNumber(myTextfieldB, theText);
}

public void textB(String theText) {
 changeNumber(myTextfieldA, theText);
}


void changeNumber(Textfield theField, String theText) {
float n = float(theText);
 if(!Float.isNaN(n)) {
   n = 1-n;
   theField.setText(""+n);
 }
 else {
   println("not a number ");
 }
}


Re: controlP5
Reply #154 - Mar 21st, 2009, 7:02pm
 
Is there an easy way now to add a text area to a control window.
Re: controlP5
Reply #155 - Mar 22nd, 2009, 2:12pm
 
Is there an option for the radioButton-element that several buttons are selected and that this is used in the application?

So for instance that you can select 2 or more of five given options, instead of only 1?

(imagine you have a list of sports, and you have to select which ones you like. It can be one, but can also be 2 or more...)
Re: controlP5
Reply #156 - Mar 27th, 2009, 2:38am
 
Hey Sojamo (and others),

I have a problem with updating/setting values of toggles and radiolists.

How can I change the value of a radiolist (called rcm) or state of a toggle, when one of the two changes.

When I do the following, I get this error:
method: toggle2ShowLayer (and also for toggle2ShowLayer)
exception:  java.lang.reflect.InvocationTargetException

Code of radiolist:
Code:

void radioBothModels1(int theValue) {
 switch(theValue) {
   case(0):
if (manualModel == true){ showManualModel = true; toggle1ShowLayer.setValue(1);}
if (importedModel == true){ showImportModel = true; toggle1ShowLayer.setValue(1);}
toggle2ShowLayer.setValue(0);
break;
   case(1):
toggle1ShowLayer.setValue(0);
toggle2ShowLayer.setValue(1);
break;
   case(2):
if (manualModel == true){ showManualModel = true; toggle1ShowLayer.setValue(1); }
if (importedModel == true){ showImportModel = true; toggle1ShowLayer.setValue(1); }
toggle2ShowLayer.setValue(1);
break;
 }
}


Code of toggles:
Code:

void toggle1ShowLayer(boolean theValue) {
 if(theValue==true) {
   if (toggle2ShowLayer.value()==0) { rcm.setValue(0); }
   else { rcm.setValue(2); }
 } else {
if (toggle2ShowLayer.value()==0) { rcm.deactivateAll(); }
else { rcm.setValue(1); }
   }
}

void toggle2ShowLayer(boolean theValue) {
 if(theValue==true) {
   if (toggle1ShowLayer.value()==0) { rcm.setValue(1); }
   else { rcm.setValue(2); }
 } else {
if (toggle1ShowLayer.value()==0) { rcm.deactivateAll(); }
else { rcm.setValue(0); }
 }
}

string to float textField input
Reply #157 - May 14th, 2009, 5:00pm
 
sorry for my english.
This is my fist experiencies width this library.

I want to know if it is posible take the textField input value like a float value. I want to use a textField like a input number controller.
Re: controlP5
Reply #158 - May 16th, 2009, 11:48pm
 
@p0lem, maybe reply #153 does what you are looking for
best,
andreas
Re: controlP5
Reply #159 - May 17th, 2009, 8:03am
 
I love this library vey much - thank you.
I'm not a very experienced programmer but have some with Processing.

I've been looking at the examples for the text field and text area. I want the user to be able to type text at least a paragraph or two long... sort of mix the funcitonality of text field and text area.

I've managed to make the text field save to a string a few lines long but can't write it back to the text field for longer than a line.  I could set it to a text area but want user to be able to go back and edit.

Do you have any suggestions on how I can make this work. Or can I look at a different approach for embedding an editable and longer text area into processing?



Re: controlP5
Reply #160 - May 20th, 2009, 2:34pm
 
Hi Sojamo! Thanks for this awesome library.

Bug Report :
1.) Unable to set the value of a matrix coordinate and have it update the appearance. Calling update() on both matrix and controlP5 does nothing. Example (click the background to attempt to set the cell location at a random row and column to true):

Quote:
import controlP5.*;

ControlP5 cp5;
Matrix m;
int backgroundColor;
int numRows = 20;
int numColumns = 10;
int cellHeight = 10;
int cellWidth = 20;

void setup()
{
  size( 600, 400 );
  backgroundColor = color( 0 );
  cp5 = new ControlP5( this );
  cp5.addMatrix( "firstMatrix", cellWidth, cellHeight,
        10, 10, cellWidth * numColumns, cellHeight * numRows );
  m = (Matrix) cp5.controller( "firstMatrix" );
}

void draw()
{
  background( backgroundColor );
}

void mouseClicked()
{
  backgroundColor = color( random( 255 ), random( 255 ), random( 255 ) );
  int randomRow = (int) random( 0, numRows );
  int randomColumn = (int) random( 0, numColumns );
  m.setValue( randomRow * 256 + randomColumn );
}

void controlEvent(ControlEvent theEvent) {
  println("## controlEvent / id:"+theEvent.controller().id()+"\n"+
      "name:"+theEvent.controller().name()+"\n"+
      "label:"+theEvent.controller().label()+"\n"+
      "value:"+theEvent.controller().value()+"\n"+
      "matrixValue x:"+Matrix.getX(theEvent.controller().value())+"\n"+
      "matrixValue y:"+Matrix.getY(theEvent.controller().value())+"\n"      
      );
}





Offer of Services
I have a good bit of experience with java and event programming. A few months ago in this thread you mentioned that you're having difficulty coping with the expanding size and scope of the library. Do you need development help? I like the library and am willing to write some junit tests, adopt a module, clean up the javadocs, find a bug to help out.

Access Restrictions
Will you consider making Controller.isInside() public, so we can subclass your implementations for different effects without having to be in your package? For example, I have my own matrix implementation that I based on your code from svn. I had to change and recompile your library to use it - and I'd prefer not to.
Re: controlP5
Reply #161 - Aug 8th, 2009, 12:49am
 
Found a small, yet annoying bug. SetLabelVisible doesn't work for toggle buttons.

Code:
import controlP5.*;

ControlP5 cP5;

void setup() {
 size(400,400);
 cP5 = new ControlP5(this);
 
 cP5.addToggle("t",false,100,160,20,20).setLabelVisible(false);
 cP5.addSlider("s",0,100,150,160,20,20).setLabelVisible(false);
}
 
void draw() {
}
Re: controlP5
Reply #162 - Aug 15th, 2009, 10:15am
 
Sojamo, thanks very much for this excellent library.

I have a question about controlp5 numberboxes. By default, moving the mouse 1px up decrements the numberbox value by 1.0, and moving it 1px down increments it by 1.0. Is there any way to change this so that mouse movements of 1px result in smaller or larger changes? For example, 1px movements resulting in changes of 0.01.
Re: controlP5
Reply #163 - Aug 24th, 2009, 6:06am
 
Hi,

Regarding controlP5 radio controls...

Has anyone experienced any odd behaviour when using multiple radio controls in a sketch?

I have written a small app using controlP5 which uses three radio controls to select a subset of data to display. The first radio control has 4 items, the second has 5 items and the last has 8 items.

The first and second radio controls work exactly as expected. However, with the third control I can not select any of the first 5 items, only items 6, 7 and 8. These last three items do behave as expected. In addition I can swap the items in the list around, and the last 3 items always work correctly.

Hence I am pretty sure (he says!) that I have coded them correctly, and can not see what would cause some, but not all, of the radio items to misbehave.

Any help/advice/pointers most welcome! Thanks.
Re: controlP5
Reply #164 - Aug 24th, 2009, 6:34am
 
hi,
tried to duplicate what you experience with radio buttons, but worked for me. you can share any code that shows the behavior you describe?
best,
andreas

Pages: 1 ... 9 10 11 12 13 ... 17