Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

C++ menu navigation with arrow keys

Posted on 2003-03-03
6
Medium Priority
?
1,293 Views
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
----------
0
Comment
Question by:Jonman364
  • 4
  • 2
6 Comments
 
LVL 8

Accepted Solution

by:
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.

Exceter
0
 

Author Comment

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

Author Comment

by:Jonman364
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).
0
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!

 
LVL 8

Expert Comment

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

Author Comment

by:Jonman364
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"
0
 

Author Comment

by:Jonman364
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.
0

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Question has a verified solution.

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

  Included as part of the C++ Standard Template Library (STL) is a collection of generic containers. Each of these containers serves a different purpose and has different pros and cons. It is often difficult to decide which container to use and …
Container Orchestration platforms empower organizations to scale their apps at an exceptional rate. This is the reason numerous innovation-driven companies are moving apps to an appropriated datacenter wide platform that empowers them to scale at a …
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 viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.

572 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