Displaying SD file names on an LCD Menu

Ok, this looks way too big for me to wrap my head around. I can logically see what needs done, but I don't think I can put it together.
I need to be able to list files on the display, and have a user select one of them. They have a 12 digit keypad for user input. It's a 4x20 LCD. The number of files is unknown, but like between 15 - 20 files. So I'm picturing doing it like this on my LCD:

  1. Filename1
  2. Filename2
  3. Filename3
    4 More 5 Cancel

Choosing 1-3 will select that file, choosing 4 will then display the next 3 files...

I've read thru all the SD card examples and understand them. And I can tell I will need to use this to access the files:
File entry = dir.openNextFile();
But I'll need my menu to keep looping thru the filenames until the user selects one, and then how will I know which one they selected... I've got a good start on it, take a look at my code. I'm just really stumped on this part. I've got my code commented well, so you can see what I'm doing. The disp. functions for the LCD library, but they're easy to follow. I'm stumped in the selection Select_Part()
Thanks so much for taking time to help.

#include <SPI.h> //for SD card
#include <SD.h>  //for SD card
#include <Wire.h>     //for I2C LCD/KEYPAD
#include <bv4619_I.h> //for I2C LCD/KEYPAD
//LCD stuff
LCD disp(0x39); // constructor defines pins and the address of the device
//SD card stuff
const int chipSelect = 10; //chip select pin for SD card
const int LEN = 43; //max length of lines on SD card
char line[LEN + 1]; // +1 allows space for the null terminator
int CharCounter = 0; //SD card line character counter
File root;

void setup() {
  Serial.begin(9600);   // Open serial communications and wait for port to open:
  Serial.print("Initializing SD card...");
  // see if the card is present and can be initialized:
  if (!SD.begin(chipSelect)) {
    Serial.println("Card failed, or not present");
    // don't do anything more:
    return;
  }
  Serial.println("card initialized.");
  disp.lcd_bl(10, 0, 0); //turn on LCD backlight
}

void loop() {
  Main_Menu(); //show the main menu
}

void Main_Menu() {
  disp.lcd_cls(); // clear display
  disp.lcd_rowcol(0, 2); //row, col
  disp.lcd_print("DRILL TABLE MENU");
  disp.lcd_rowcol(1, 0); //row, col
  disp.lcd_print("1. SELECT A PART");
  disp.lcd_rowcol(2, 0); //row, col
  disp.lcd_print("2. ADD/REMOVE PART");
  disp.lcd_rowcol(3, 0); //row, col
  disp.lcd_print("3. MANUAL POSITION");
  while (1) {
    byte k = checkKeyBuffer(); //get a keypress from the user
    switch (k) {
      case 1:
        Select_Part(); //select a part (file name) from a list of all file names
        break;
      case 2:
        Add_Remove(); //show the selected menu
        break;
      case 3:
        Manual_Position(); //show the selected menu
        break;
    }
  }
}

void Select_Part() {
  disp.lcd_cls(); //clear display
  disp.lcd_print("1. FILENAME 1"); //**NAME OF THE FIRST FILE
  disp.lcd_rowcol(1, 0); //row, col
  disp.lcd_print("2. FILENAME 2"); //**NAME OF THE 2ND FILE
  disp.lcd_rowcol(2, 0); //row, col
  disp.lcd_print("3. FILENAME 3"); //**NAME OF THE 3RD FILE
  disp.lcd_rowcol(3, 0); //row, col
  disp.lcd_print("4. MORE  5. CANCEL"); //4 OR 5 TO SEE MORE FILE NAMES OF CANCEL
}

void Add_Remove() {}

void Manual_Position() {}

int checkKeyBuffer() { //check key buffer every 200 millis
//THIS WILL RETURN THE KEYPRESS
//THE NUMBERS 0 THRU 9; 10 = *; 11 = #; 12 = NO KEY
}

ps. The files will all be .txt files and they will all be 8 chars or less in their filename
I'm working with an UNO chip, Atmega328P, so not an abundance of memory

Hi, guys,I also want to display files name on lcd .i use "u8glib",it has a "menu"example, only display known menus.Are you understand how to modify code to display files name ? And now ,can you display filename on your lcd?
/////////////////////////////print sd filename and number to monitor(arduino sd example)/////////////////
void printDirectory(File dir, int numTabs) {
while (true) {

entry = dir.openNextFile();
if (! entry) {
MENU_ITEMS = nfiles;
Serial.println(MENU_ITEMS);// no more files
break;
}
for (uint8_t i = 0; i < numTabs; i++) {
Serial.print('\t');
}
if (entry.isDirectory()) {
Serial.println(" ");
//printDirectory(entry, numTabs + 1);
} else {
String line = entry.name ();
// files have sizes, directories do not
Serial.println("\t\t");
//Serial.println(entry.size(), DEC);
nfiles++;

}
entry.close();
Serial.print(line);
}

Serial.println(nfiles);
}
//////////////////u8glib menu example///////////////
void drawMenu(void) {
uint8_t i, h;
u8g_uint_t w, d;
u8g.setFont(u8g_font_6x13);
u8g.setFontRefHeightText();
u8g.setFontPosTop();
/////////////////////////////I want to record filenames to const char menu_strings[ MENU_ITEMS] []/////are there any ways,thanks///////////////////////////
const char menu_strings[ MENU_ITEMS] = {"First Line", "Second Item123", "3333333"};
h = u8g.getFontAscent()-u8g.getFontDescent();
w = u8g.getWidth();
for( i = 0; i < MENU_ITEMS; i++ ) {
d = (w-u8g.getStrWidth(menu_strings
))/2;

  • u8g.setDefaultForegroundColor();*
  • if ( i == menu_current ) {*
    _ u8g.drawBox(0, i*h+1, w, h);_
  • u8g.setDefaultBackgroundColor();*
  • }*
    u8g.drawStr(d, ih, menu_strings);
    _
    }_
    _
    }*_

* void updateMenu(void) {*
* if ( uiKeyCode != KEY_NONE && last_key_code == uiKeyCode ) {
_
return;_
_
}_
last_key_code = uiKeyCode;*

* switch ( uiKeyCode ) {*
* case KEY_NEXT:
menu_current++;
if ( menu_current >= MENU_ITEMS )
menu_current = 0;
menu_redraw_required = 1;
_
break;_
case KEY_PREV:
if ( menu_current == 0 )
menu_current = MENU_ITEMS;
menu_current--;
menu_redraw_required = 1;
_
break;_
_
}_
_
}*_