Question : Drop Down Menu by C(LInux/Console Base)

HI
I would be really great full if any one can give me sample script or give me a link where it will show how to create a simple down menu by C.
I know you can do by curses. but i want to see a sample code on this rather then just references website ..

File                           Reports
-New Record          -Show all data
-Save Record         -Select Reports
-Quite  [F3]        -  

When i will click or press F3 it will quite the program.
 
so please give me sample code on this or past few link where it will show how to create something like this .

Really great full for your help.
I need LInux Console base solution. Not Windows

Answer : Drop Down Menu by C(LInux/Console Base)

You must use ncurses: it's a console library that make able to create GUI-like programs like the ones you have with kernel configuration, dpkg interface on debian/ubuntu and similar. It works in console by using ANSI codes. It make you available also mouse interface and other stuff.
To start, see the "ncurses-programming-howto": it provide a step-by-step tutorial on using ncurses. it's a good idea to follow it from start - ncurses have a steep learning curve.
The 18th chapter is dedicated to menus.

http://www.faqs.org/docs/Linux-HOWTO/NCURSES-Programming-HOWTO.html

hope that helps. I attach also the "basic menu example" from that document. Enjoy ;-)
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
include <curses.h>
#include <menu.h>

#define ARRAY_SIZE(a) (sizeof(a) / sizeof(a[0]))
#define CTRLD 	4

char *choices[] = {
                        "Choice 1",
                        "Choice 2",
                        "Choice 3",
                        "Choice 4",
                        "Exit",
                  };

int main()
{	ITEM **my_items;
	int c;				
	MENU *my_menu;
	int n_choices, i;
	ITEM *cur_item;
	
	
	initscr();
	cbreak();
	noecho();
	keypad(stdscr, TRUE);
	
	n_choices = ARRAY_SIZE(choices);
	my_items = (ITEM **)calloc(n_choices + 1, sizeof(ITEM *));

	for(i = 0; i < n_choices; ++i)
	        my_items[i] = new_item(choices[i], choices[i]);
	my_items[n_choices] = (ITEM *)NULL;

	my_menu = new_menu((ITEM **)my_items);
	mvprintw(LINES - 2, 0, "F1 to Exit");
	post_menu(my_menu);
	refresh();

	while((c = getch()) != KEY_F(1))
	{   switch(c)
	    {	case KEY_DOWN:
		        menu_driver(my_menu, REQ_DOWN_ITEM);
				break;
			case KEY_UP:
				menu_driver(my_menu, REQ_UP_ITEM);
				break;
		}
	}	

	free_item(my_items[0]);
	free_item(my_items[1]);
	free_menu(my_menu);
	endwin();
}
	
Random Solutions  
 
programming4us programming4us