We are about to switch to a new forum software. Until then we have removed the registration on this forum.
How do I limit the amount of characters a user may press within a TextField?
http://www.sojamo.com/libraries/controlP5/reference/controlP5/Textfield.html
Here is the API. Well organized but wished it explained the methods more in depth.
Perhaps? http://www.sojamo.com/libraries/controlP5/reference/controlP5/Textfield.html#setWidth(int)
Gives an array out of bounds error
The setWidth() method just allows the bar to be wider. It has nothing to do with the character limit.!
Maybe use a more detailed overload version for addTextField()? :-?? http://www.sojamo.com/libraries/controlP5/reference/controlP5/ControlP5Base.html#addTextfield(java.lang.String, int, int, int, int)
Sorry, dunno either! b-(
It probably is not implemented.
We can still throw away the exceeding characters via substring(): https://Processing.org/reference/String_substring_.html
Good idea but how would you determine if the box currently has 3 chars so once it hits 4 chars it substrings it back to 3.
Use length() in order to get String's size: https://Processing.org/reference/String_length_.html
Crossposted: http://stackoverflow.com/questions/31676793/text-field-in-processing-language-using-cp5
Answers
http://www.sojamo.com/libraries/controlP5/reference/controlP5/Textfield.html
Here is the API. Well organized but wished it explained the methods more in depth.
Perhaps? http://www.sojamo.com/libraries/controlP5/reference/controlP5/Textfield.html#setWidth(int)
Gives an array out of bounds error
The setWidth() method just allows the bar to be wider. It has nothing to do with the character limit.!
Maybe use a more detailed overload version for addTextField()? :-??
http://www.sojamo.com/libraries/controlP5/reference/controlP5/ControlP5Base.html#addTextfield(java.lang.String, int, int, int, int)
Sorry, dunno either! b-(
It probably is not implemented.
We can still throw away the exceeding characters via substring():
https://Processing.org/reference/String_substring_.html
Good idea but how would you determine if the box currently has 3 chars so once it hits 4 chars it substrings it back to 3.
Use length() in order to get String's size:
https://Processing.org/reference/String_length_.html
Crossposted: http://stackoverflow.com/questions/31676793/text-field-in-processing-language-using-cp5