Arduino keypad to string

Hi,
I've been trying, for over a week now, to create a program that will store my keypad presses into variable, and with a press of an enter, it will switch to the next variable to store the presses. The program is made to load addresses (mainly IP addresses) to different devices over serial connections. Because there are different types of addresses, each time the user press enter in the keypad (made the # button to a '\r' char) the program needs to switch to the next type of address and get the key presses from the keypad and store them until the next '\r' press. My problem is that I don't know how to store those addresses in the Arduino, and switch to a different "char" (I used char because I didn't knew how to convert them to store key presses into string) every '\r' press. I've included my complete code below, but the problem is in handlerManualEntery.

bool handlerManualEntry( void )
{
    static uint8_t
        stateManualEntry = statesFunc::ST_INIT;
       
    char keyval = ReadKey();
    switch( stateManualEntry )
    {
        case    statesFunc::ST_INIT:
            //do whatever inits you need here (screen, variables etc)
                      
            stateManualEntry = statesFunc::ST_RUN;
           
        break;

        case    statesFunc::ST_RUN:
            //is there a keypress?
            if( keyval != NO_KEY )
            {
                switch( keyval )
                {
                  
                    case    '\r':
                        //when we get a return, send it to the serial port                   
                        Serial.print( '\n' );
                        u8g2log.print('\f');
                        for(int i=0; i<6; i++)
                        {
                          if(i == 0)
                          {
                          Serial.print(ethernetIP);
                          }
                        else if(i == 1)
                          {
                          Serial.print(ethernetSubnet);
                          }
                        else if(i == 2)
                          {
                          Serial.print(ethernetGetway);              
                          }
                        else if(i == 3)
                          {
                          Serial.print(vmeIP);
                          }
                        else if(i == 4)
                          {
                          Serial.print(vmeSubnet);
                          }
                        else if(i == 5)
                          {
                          Serial.print(eventPort);
                          }
                        else if(i == 6)
                          {
                          Serial.print(timeOut);
                          }
                        }
                        //and finish out by returning the state to INIT and returning true
                        //stateManualEntry = statesFunc::ST_INIT;
                        //return true;
                       
                    break;
                    case 'D':                    
                          u8g2log.print('N');
                          Serial.print('N');                                                   
                    break;

                         
                    case 'C':                  
                          u8g2log.print('Y');
                          Serial.print('Y');                         
                    break;
       
                    default:
                        //for any other key, print to the serial port and LCD
                        u8g2log.print(keyval);
                        
                        enterAddresses();   
                    break;
                   
                }//switch
               
            }//if
           
        break;

    }//switch

    return false;

}//handlerManualEntry

Thanks ahead.

manualAddresses.ino (1.06 KB)

nested_menus_test.ino (20.6 KB)

bool handlerManualEntry( void )
{
static uint8_t // Is there supposed to be a variable name associated with this?
stateManualEntry = statesFunc::ST_INIT;

I leave it empty for now since I don't have to use it, I didn't created this program, so I just added my needs to it.
The "manual" enter of addresses was kind of hard for me (I'm pretty familiar with Arduino but this part of the program is beyond my abilities) and I have no idea were to start.

emribg:
My problem is that I don't know how to store those addresses in the Arduino, and switch to a different "char" (I used char because I didn't knew how to convert them to store key presses into string) every '\r' press.

Start with understanding serial input basics.

[color=rgba(0, 0, 0, 0.850980392156863)] [/color] if(keyval != '\r')
  {
    if(pointer == 1)
    {
      keyval = keypad.getKey();
      u8g2log.print(keyval);
      ethernetIP += keyval;
    }

Note that keypad.getKey() returns zero (a.k.a. NO_KEY) if no key has been pressed since the last time getKey() was called. I expect you are getting a LOT of zeroes. You already have a 'keyval'. Why call getKey() to get a new one before you store it in your String?!?