how to implement a menu ?

S

sugaray

hey, i'm having this problem when i'm trying to implement menu
capability in my program, using direction key UP and DOWN to move the
a bar between the menu items, press enter to select it, cudgle my
brain hardly as possibly could I just couldn't figure out how to do
this. and i'm using Visual C++ and I don't know if there's any library
functions to handle text attributes like in Borland C (textcolor()
etc.). so hope some could help me out, thanx in advance.

int scan,extended;
printf("1. log on system\n");
printf("2. log out system\n");
printf("3. inquire record\n");
printf("4. record statistics\n");
printf("5. exit system\n");
while((scan=getch())==0 || scan==0xe0) {
extended=getch();
switch(extended) {
case 0x48:
keyup();
break;
case 0x50:
keydown();
break;
default:
oops();
}

Gary.
 
M

Martijn

Hi Sugaray,
hey, i'm having this problem when i'm trying to implement menu
capability in my program, using direction key UP and DOWN to move the
a bar between the menu items, press enter to select it, cudgle my
brain hardly as possibly could I just couldn't figure out how to do
this. and i'm using Visual C++ and I don't know if there's any library
functions to handle text attributes like in Borland C (textcolor()
etc.). so hope some could help me out, thanx in advance.

You might want to check section 19 of the faq:
http://www.eskimo.com/~scs/C-faq/s19.html

Good luck,
 
M

Malcolm

sugaray said:
hey, i'm having this problem when i'm trying to implement menu
capability in my program
You can't manipulate the screen display in ANSI C, and generally you can't
use printf() with platform-specific console functions either.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,079
Messages
2,570,574
Members
47,206
Latest member
Zenden

Latest Threads

Top