How to change the defauld settings of the label of a textfield using Controlp5 library

edited October 2015 in Library Questions

I would like to have the label of a Controlp5 Textfield set to LowerCase and placed left of the Textfield.

t.toUpperCase(false); // t being the textfield does not work.



  • Answer ✓

    Hi, since this might not be immediately obvious, here an example of how to modify a Caption Label:

    import controlP5.*;
    ControlP5 cp5;
    void setup(){
      cp5 = new ControlP5(this);
      PFont font = createFont("arial",20);
      Textfield t = cp5.addTextfield("textValue")
      Label label = t.getCaptionLabel(); 
      // in order to update the upperCase state, you need to invoke setText()
      label.align(ControlP5.LEFT_OUTSIDE, CENTER);
    void draw(){
  • edited October 2015

    Thank you for your quick reply.

    CENTER in the line: label.align(ControlP5.LEFT_OUTSIDE, CENTER); does not have effect and can be replaced by any variable. Why?

    I have a few more questions related to a Textfield.

    1) How to change the bordercolor and borderwidth of the Textfield?

    2) Is it possible to CENTER the entered text in the Textfield?

    Thanks in advance for your help.

    PS: Do I have to post the Textfield questions as a NEW question.

Sign In or Register to comment.