How do you make a menu system for a console application. Not just a display, and you enter a number, but where you can use the arrow keys and each selection is highlighted or something. How do I do that?
How do you make a menu system for a console application. Not just a display, and you enter a number, but where you can use the arrow keys and each selection is highlighted or something. How do I do that?
text color and background color in the console have been talked about a lot. search for those threads and take it one step at a time.
first print a menu.
use methods from above search to highlight an item.
use getch() check for valid keypresses then if needs be move the highlighting by reprinting the menu over itself but with the colours changed as you need.
simple enough with a little thought.
Free the weed!! Class B to class C is not good enough!!
And the FAQ is here :- http://faq.cprogramming.com/cgi-bin/smartfaq.cgi
Ok, make you a file in Paint or whatever you use that has the same deminsions in PIXELS. For example, if you use mode 13h you would make it 320 pixels by 200 pixels. Now this is the background or backdrop. Now useing the text tool write all your options on there, once you get the background ready. Now make you a file of an arrow, or box or whatever, that will show which option is selected. Make the program draw the backdrop. Then the arrow pic you drew left of the first option. Then use getch(); and then a switch that checks if the user pressed up or down. If up, then draw the backdrop, and draw the arrow left of the option above the option you were on. If you are at the top, make it draw the arrow at the option at the far bottom. You should have a variable that holds what option you have selected. If the user presses space bar, it reads what the option variable says, then it draws the backdrop to the next set of options. And the whole proccess starts all over again. I made an attractive menu in about 15 mins. And it took me about 2 mins to draw all the backdrops and arrow.
Also, if you dont want to use graphics, just print all options, then substitute the arrow pic with > or something.