We are about to switch to a new forum software. Until then we have removed the registration on this forum.
I am fairly new to processing and the controlp5 library. I am wanting to link a textfield and a slider together so that if the slider is moved the slider value displays in the textfield. I also want it to work the other way around where if a number is typed in the textfield it will update the value in the slider. All the examples I can find show just the first option. Is there a way to get both to display the same values as I described? Thank in advance for any help you can provide.
Answers
I have the Slider controlling the Textfield but I still can not seem to get the textfield to adjust the Slider. This is the code I currently have:
I am getting an error message that says "The method setValue(float) in the type Slider is not applicable for the arguments (String)" Any ideas on how to get this to work?
Well, if it says it expects a
float
data-type, you gotta provide exactly that! #-o1st, you gotta declare variable theValue as
float
instead of String @ #56.Then @ #58, remove "" +, lest the expression results in a String again, due to concatenation w/ theValue! 8-X
Problem solved. I revised the last block of the coded to this:
now it works fine.
Congratz! Now I've realized that addTextfield() from ControlP5 demands that Speed() have a String parameter! :@)
But your problem is that setValue() wants a
float
, and you gotta convert that from a String!I'm not used w/ most 3rd party libraries yet! :-\"