I just tried my hand at making a very simple GUI in a console window. My code seems like it would work, but it's not. The value starts out as a "1", which means that the left option is highlighted. When I hit the right arrow key it highlights the right option, but then it re-highlights the left option.
I tried a test and put a cout statement directly after the GUI's functions call. When it does the displaying, I found that it completely exits the functions and displays the statement. I have the call and the cout in a while loop, so then it goes back into the functions and it starts over on the left side.
The code is too large to post on here, so please send me an e-mail if you plan on helping me and I will send you my source code.
I'm not sure how you are getting the arrow key inputs for your system but I suspect it's on lines 176-197. In those two conditions, both arrow keys appear to do exactly the same thing. Might that be part of the problem?
if ( GetAsyncKeyState(VK_RIGHT) & 0x8000 )
{
if (highlight1 == 1) {
highlight1++;
goto fieldMenu;
}
if (highlight1 == 2) {
highlight1--;
goto fieldMenu;
}
}
if ( GetAsyncKeyState(VK_LEFT) & 0x8000 )
{
if (highlight1 == 1) {
highlight1++;
goto fieldMenu;
}
if (highlight1 == 2) {
highlight1--;
goto fieldMenu;
}
}
If you look at it closely: If selection one if highlighted (highlight1 = 1) and the user hits RIGHT key, then highlight1 is increased to two, then it goes back to the beginning of the function and the screen is refreshed. Same thing for others but just reversed.
I don't see anything wrong with it, but if you do please share. haha. This code has given me so many problems.