CLI (C++) | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

CLI (C++)

Hi! I'd like to make a CLI that has supports for example menus that highlight the "hovered" option (which can be changed eg. with the arrow keys), and of course some way to for example write the values to the menu or change the attributes otherwise. What I think I need to do this is a way to change already printed lines in the command line window, use colors or fonts for highlighting, and get continuous keyboard input from the user. I did some small research and found nothing but \r, which won't help a lot when editing multiple lines, I suppose. I have also heard about event-based programming and I could implement it on my own if I just knew how tho get that input. Tell me if you need more information on what I'm trying to accomplish. Thanks in advance!

6th Oct 2021, 1:10 PM
Joel Kronqvist
Joel Kronqvist - avatar
2 Answers
+ 3
You can use a middleware to buffer the inputs and then clean screen and reprint, or use terminal ANSI for cursor movement and overwrite.
6th Oct 2021, 1:43 PM
Valen.H. ~
Valen.H. ~ - avatar
0
Ok, I will look into these, thanks for some start :)
6th Oct 2021, 2:00 PM
Joel Kronqvist
Joel Kronqvist - avatar