 }
 
 //-----------------------------------------------
-// Draw the keypad.
+// Draw the keypad, handle interactions with it.
 //     offset  the index into the frequency buffer of digit to change.
+//
+// We highlight the digit we are going to change.
+// We have a small event loop here to handle the keypad.
 //-----------------------------------------------
 
 void keypad_show(int offset)
 {
   // highlight the frequency digit we are changing
-  freq_select(offset);
-
+  freq_show(offset);
+
+  // remove the online/menu buttons
+  undrawOnline();
+  undrawMenu();
+  
   // draw keypad basic outline
   tft.fillRoundRect(KEYPAD_X, KEYPAD_Y, KEYPAD_W, KEYPAD_H, BUTTON_RADIUS, ILI9341_BLACK);
-  tft.fillRoundRect(KEYPAD_X+1, KEYPAD_Y+1, KEYPAD_W-2, KEYPAD_H-2, BUTTON_RADIUS, KEYPAD_EDGE_COLOR);
+  tft.fillRoundRect(KEYPAD_X+1, KEYPAD_Y+1, KEYPAD_W-2, KEYPAD_H-2, BUTTON_RADIUS, KEYPAD_BG);
 
   // draw buttons on the keypad
   for (int y = 0; y < 3; ++y)

  for (int i = 0; i < NUM_F_CHAR; ++i)
  {
    if (i == select)
      tft.fillRect(char_x_offset[i], 2, CHAR_WIDTH+2, DEPTH_FREQ_DISPLAY-4, FREQ_SEL_BG);
    else
      tft.fillRect(char_x_offset[i], 2, CHAR_WIDTH+2, DEPTH_FREQ_DISPLAY-4, FREQ_BG);
                   
    if ((freq_display[i] != '0') || !leading_space)
    {
      tft.drawChar(char_x_offset[i], FREQ_OFFSET_Y, freq_display[i], FREQ_FG, FREQ_BG, 1);
      leading_space = false;
    }
  }
}

//-----------------------------------------------
// Set a digit of the frequency display.
//     offset     offset into the frequency digits buffer
//     new_digit  new digit, binary [0-9]
// Also updates the top of screen display.
//-----------------------------------------------

void freq_set_digit(int offset, int new_digit)
{
  Serial.printf("freq_set_digit: offset=%d, new_digit=%d\n", offset, new_digit);
  freq_display[offset] = new_digit;
  tft.setFont(FONT_FREQ);
  tft.drawChar(char_x_offset[offset], FREQ_OFFSET_Y,
               freq_display[offset], FREQ_FG, FREQ_BG, 1);
}

//-----------------------------------------------
// Draw a selected digit in the frequency display.
//     select  index of digit to highlight
//-----------------------------------------------

void freq_select(int select)
{
  tft.fillRect(char_x_offset[select]-1, 2,
               CHAR_WIDTH+1, DEPTH_FREQ_DISPLAY-4, FREQ_SEL_BG);
  tft.setFont(FONT_FREQ);
  tft.drawChar(char_x_offset[select], FREQ_OFFSET_Y,
               freq_display[select], FREQ_FG, FREQ_BG, 1);
}

//-----------------------------------------------
// Unselect a digit in the frequency display.
//     select  index of digit to unselect
//-----------------------------------------------

void freq_unselect(int select)
{
  Serial.printf("freq_unselect: select=%d\n", select);
  tft.fillRect(freq_char_x_offset[select]-1, 2,
               CHAR_WIDTH+1, DEPTH_FREQ_DISPLAY-4, FREQ_BG);
  tft.setFont(FONT_FREQ);
  tft.drawChar(freq_char_x_offset[select], FREQ_OFFSET_Y,
               freq_display[select], FREQ_FG, FREQ_BG, 1);
}

