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 SPACEs in texts buttons?
Page Index Toggle Pages: 1
ControlP5 SPACEs in texts buttons??? (Read 719 times)
ControlP5 SPACEs in texts buttons???
Dec 29th, 2008, 10:03am
 
1.- It's possible to put spaces in text buttons?
2.- It's possible to represent Lowercase's texts?

I try to do:
controlP5.addSlider("slider speed",0,10,5,10,10,30,14);
--> but it represents SLIDERSPEED
 (without spaces and uppercase)

Thanks in advance!!
Re: ControlP5 SPACEs in texts buttons???
Reply #1 - Jan 3rd, 2009, 2:51am
 
i asked this previously but never got an answer.  easiest fix is to use underscore (e.g. "SLIDER_SPEED") instead of a space.  you can also hide the label and put your own text in.  you can use the textLabel function in controlP5 (http://www.sojamo.de/libraries/controlP5/examples/ControlP5textlabel/ControlP5Textlabel.pde), or you can use the same font "standard_07_57," available from http://www.miniml.com for $10, or AdvoCut which looks almost identical at 10pt, includes lowercase, and is free (http://www.dafont.com/advocut.font).  i believe andreas, author of controlP5, intends one day put in full font support but hasn't had time yet...


Re: ControlP5 SPACEs in texts buttons???
Reply #2 - Jan 4th, 2009, 5:36am
 
when adding a slider (any controller) the given name should not include a space. the reason for this is that controlP5 tries to find a method or a field with the given name and links it to the controller in case of a match to automatically forward any changes.
in the example above "slider speed" therefore defaults back to "sliderspeed" and acts as a named id for controlP5.
by default the caption label of a controller will have this name, but this can be changed by using:

Code:

Slider s = controlP5.addSlider("sliderSpeed",0,10,5,10,10,30,14);
s.captionLabel().set("slider speed");
s.captionLabel().toUpperCase(false);



@eforman, no time yet is correct, thanks for reminding me Smiley
Re: ControlP5 SPACEs in texts buttons???
Reply #3 - Jan 12th, 2009, 5:34pm
 
Thanks. We will wait for new fonts changes in this nice library!!!!!
Re: ControlP5 SPACEs in texts buttons???
Reply #4 - Jan 14th, 2009, 6:07am
 
cool.  it would be nice at some point to have these functions in the documentation.  if they are there, i couldn't find them.  

one question - how do you do this with a Button, since you can't use the object type Button as processing throws an error - "type Button is ambiguous"?

e.g.

Code:
Button b = controlP5.addButton("Go",0,50,50,20,20);
b.captionLabel().set("Go do that thing");


also, can you clear up what the first parameter after the name in the Button constructor is for?

thx

Re: ControlP5 SPACEs in texts buttons???
Reply #5 - Jan 14th, 2009, 12:33pm
 
Eric F. wrote on Jan 14th, 2009, 6:07am:
cool.  it would be nice at some point to have these functions in the documentation.  if they are there, i couldn't find them.  

you are right, they arent there. needs to be added under the Controller documentation.


Eric F. wrote on Jan 14th, 2009, 6:07am:
one question - how do you do this with a Button, since you can't use the object type Button as processing throws an error - "type Button is ambiguous"

use
Code:

controlP5.Button b = controlP5.addButton("Go",0,50,50,20,20);
b.setCaptionLabel("Go do that thing");

controlP5 here is the name of the package.
with version 0.3.7 use b.setCaptionLabel("text") instead of b.captionLabel().set("text"), there is an issue with cutting off a label with the latter.


Eric F. wrote on Jan 14th, 2009, 6:07am:
also, can you clear up what the first parameter after the name in the Button constructor is for

this parameter is the value of a button and can be accessed e.g. in controlEvent like this:
Code:

void controlEvent(ControlEvent theEvent) {
println(theEvent.controller().value());
}


Page Index Toggle Pages: 1