Trouble With Creating Fullsize Text Field

I am having trouble creating a full-size Text Field using controlP5. I also want to remove the outline of the textField. I currently cannot type anything in the textField.

import controlP5.*;

ControlP5 cp5;
Textfield textField;

void setup()
{
  size(1000, 750);
  
  cp5 = new ControlP5(this);

  // Text Area
  textField = cp5.addTextfield("Text Field").setPosition(0, 0).setSize(width, height)
                .setFont(createFont("Helvetica", 16))
                .setColorBackground(color(255))
                .setColor(color(0))
                .setAutoClear(false);
}

Answers

  • Try this code.

    import controlP5.*;
    
    ControlP5 cp5;
    Textfield textField;
    
    void setup()
    {
      size(1000, 750);
    
      cp5 = new ControlP5(this);
    
      // Text Area
      textField = cp5.addTextfield("Text Field").setPosition(0, 0).setSize(width, height)
                    .setFont(createFont("Helvetica", 16))
                    .setColorBackground(color(255))
                    .setColor(color(0))
                    .setAutoClear(false);
    }
    
    void draw()
    {
    }
    

    Not sure what's the best way is to remove the outline, maybe just move it to an y position of -1 and give it a seize of height+2?

Sign In or Register to comment.