C++ menu navigation with arrow keys

Posted on 2003-03-03
Medium Priority
Last Modified: 2011-04-14
How do I capture when an arrow key is pressed so that I can highlight a different option of the menu. The menu would look something like this:
Main Menu

Option 1         Option2
Option 3         Option4
Question by:Jonman364
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 2

Accepted Solution

Exceter earned 150 total points
ID: 8061414
What compiler are you using? The problem is that you need a function similar to getch(). The only difference being it needs to return int instead of char because the scan codes for the arrow keys require two bytes to store and a char only stores one, on windows machine anyway.


Author Comment

ID: 8062482
I'm using dev c++. My program will be running without windows loaded.

Author Comment

ID: 8070065
Never mind the last post. I'm now using DJGPP. I thought there was an option for dos program (not just console program).

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.


Expert Comment

ID: 8071230
You wouldn't consider using Borland would you?

Author Comment

ID: 8073144
i have borland c++ builder 5.5, but when i compile a program with it, then try to run the exe file on my dos machine I get a message that says "This program must be run under Win32"

Author Comment

ID: 9334567
Wow this question is still open? I don't remember excatly what I did to solve my problem. I don't believe I had to change compilers. But as I look back to some old files from the time, it looks like I used getch() so I'm awarding points to Exceter. Not only because he was the only one to tell me to use getch(), but also he was the only one to try to anwer my question.  I can't test my old code to see if it works because I'm running Linux only now, and therfore don't have conio to test it with.

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Written by John Humphreys C++ Threading and the POSIX Library This article will cover the basic information that you need to know in order to make use of the POSIX threading library available for C and C++ on UNIX and most Linux systems.   [s…
Introduction This article is a continuation of the C/C++ Visual Studio Express debugger series. Part 1 provided a quick start guide in using the debugger. Part 2 focused on additional topics in breakpoints. As your assignments become a little more …
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…
Suggested Courses

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question