User Type Input

Hello, I am having trouble with this, when I press enter for the first screen, it switches to the next screen just fine. But I cannot type anything in on the second screen as I should be able to.

//sets up all of the inputs
String x1 = "";
String x2 = "";
String x3 = "";
String x4 = "";
String x5 = "";
String x6 = "";
String x7 = "";
String x8 = "";
String y1 = "";
String y2 = "";
String y3 = "";
String y4 = "";
String y5 = "";
String y6 = "";
String y7 = "";
String y8 = "";

//sets up indents
int indent1 = 10;
int indent2 = 150;

void setup(){
  size(600,600);
  background(255);
}

void draw(){
  textSize(20);
  fill(0);
  text("Hello, when we get there please enter each number"+"\n"+"in its coresponding  space.",indent1,160);
  text("If you dont have a number for the space, leave it blank.",indent1,270);
  text("Press enter to accept the number"+"\n"+"so, please press enter now.",indent1,350);
  if(keyPressed){
    if(key == ENTER){
      type1();
    }
  }
}

void type1(){
  noLoop();
  stroke(255);
  fill(255);
  rect(0,0,600,600);
  fill(0);
  text("X: " + x1, indent2, 200);
}

//key inputs
void keyPressed(){
  if(key == BACKSPACE){
    x1 = x1.substring(0, max(0,x1.length()-1));
  } else {
      x1 = x1 + key;
  }
  
  if(key == BACKSPACE){
    x2 = x2.substring(0, max(0,x2.length()-1));
  } else {
      x2 = x2 + key;
    }
    
    if(key == BACKSPACE){
    x3 = x3.substring(0, max(0,x3.length()-1));
  } else {
      x3 = x3 + key;
    }
    
    if(key == BACKSPACE){
    x4 = x4.substring(0, max(0,x4.length()-1));
  } else {
      x4 = x4 + key;
    }
    
    if(key == BACKSPACE){
    x5 = x5.substring(0, max(0,x5.length()-1));
  } else {
      x5 = x5 + key;
    }
    
    if(key == BACKSPACE){
    x6 = x6.substring(0, max(0,x6.length()-1));
  } else {
      x6 = x6 + key;
  }
  
    if(key == BACKSPACE){
    x7 = x7.substring(0, max(0,x7.length()-1));
  } else {
      x7 = x7 + key;
    }
    
    if(key == BACKSPACE){
    x8 = x8.substring(0, max(0,x8.length()-1));
  } else {
      x8 = x8 + key;
    }
    
    if(key == BACKSPACE){
    y1 = y1.substring(0, max(0,y1.length()-1));
  } else {
      y1 = y1 + key;
    }
    
    if(key == BACKSPACE){
    y2 = y2.substring(0, max(0,y2.length()-1));
  } else {
      y2 = y2 + key;
    }
    
    if(key == BACKSPACE){
    y3 = y3.substring(0, max(0,y3.length()-1));
  } else {
      y3 = y3 + key;
    }
    
    if(key == BACKSPACE){
    y4 = y4.substring(0, max(0,y4.length()-1));
  } else {
      y4 = y4 + key;
    }
    
    if(key == BACKSPACE){
    y5 = y5.substring(0, max(0,y5.length()-1));
  } else {
      y5 = y5 + key;
    }
    
    if(key == BACKSPACE){
    y6 = y6.substring(0, max(0,y6.length()-1));
  } else {
      y6 = y6 + key;
    }
    
    if(key == BACKSPACE){
    y7 = y7.substring(0, max(0,y7.length()-1));
  } else {
      y7 = y7 + key;
    }
    
    if(key == BACKSPACE){
    y8 = y8.substring(0, max(0,y8.length()-1));
  } else {
      y8 = y8 + key;
    }
}

Hello @Ethanation ,

The problem is the noLoop(). The code does not get updated to place the strings.
So the ENTER key should take you to another “page” and then just keep updating that “page” as you type things
Here is part of the code working:

//sets up all of the inputs
String x1 = "";


//sets up indents
int indent1 = 10;
int indent2 = 150;
int type1 = 0;
void setup() {
  size(600, 600);
  background(255);
}

void draw() {
  textSize(20);
  fill(0);

  if (type1 == 1) {
    stroke(255);
    fill(255);
    rect(0, 0, 600, 600);
    fill(0);
    text("X =" + x1, indent2, 200);
  } else {
    text("Hello, when we get there please enter each number"+"\n"+"in its coresponding  space.", indent1, 160);
    text("If you dont have a number for the space, leave it blank.", indent1, 270);
    text("Press enter to accept the number"+"\n"+"so, please press enter now.", indent1, 350);
  }
}


//key inputs
void keyPressed() {
  if (key == ENTER) {
    type1 = 1;
  } else if (key == BACKSPACE) {
    x1 = x1.substring(0, max(0, x1.length()-1));
  } else {
    x1 = x1 + key;
    //DEBUG
    //println(x1);
  }
}

Hope it helps!