0

I am trying to use the ncurses menu library to create a menu. I found some wonderful sample code online and it displays great on my screen, however I can't figure out how to select an option and have it go to a new menu or have it select a differen't function.

I would like to select the Enter as a Student option and then have that bring up another menu and from that menu I would like to select "Create a new application" and have that navigate into creating a new application. I really don't understand how to navigate this though. Any insight?

These are my Menu Options:

char choices[][30] = {
                    "Enter as a Student",
                    "Enter as a Teacher",
                    "Exit",
                    (char)NULL
              };

This is my switch case:

    while((c = wgetch(my_menu_win)) != KEY_F(8))
    {       switch(c)
            {   case KEY_DOWN:
                menu_driver(my_menu, REQ_DOWN_ITEM);
                break;
            case KEY_UP:
                menu_driver(my_menu, REQ_UP_ITEM);
                break;
        }
                wrefresh(my_menu_win);
    }
2
Contributors
1
Reply
3
Views
4 Years
Discussion Span
Last Post by Ancient Dragon
0

Why are you checking for KEY_DOWN and KEY_UP? Shouldn't you be checking for the keys that are pressed, such as '1', '2', 'a', 'b', etc. If you have a menu that has three options and you need to enter '1', '2' or '3' then that should check for those values, not KEY_DOWN or KEY_UP.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.