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);
    }

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.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.