Hi

just wondering how i would set up a menu so that i can call anytime when pressing "M". im nearly sure it would have to be a loop but im not quite sure how to do it. can anybody help? thanks

Recommended Answers

All 7 Replies

Put the menu in a function. Call the function anytime you need it.

Hi

I'm lookin for a way to not have to call the function so that the user can input randomly

Your response makes no sense. Input randomly and call the function have nothing in common.

Hi

Randomly as in when ever they want to view the menu they can press m and I'm looking for a way to to it without placing lots of function calls in my code

There's too little information for us to make even a guess at what you need. Sorry. Details, code, and design are missing from your question.

His question is pretty clear to me.. He wants a menu in his program and when a user presses "M", the menu shows/hides itself. The user can press "M" at any time during execution. Doesn't matter where in the program they press it..


I would do something like:
Create a backgroundworker/thread that checks for the press of the 'M' key while the program is active/visible on screen. When 'M' is pressed, the menu opens.. simple as that.
Basically a thread with a hotkey 'M'. Also you might wanna specify if your using .Net or just a plain old console program or Win32 API.

His question is pretty clear to me.. He wants a menu in his program and when a user presses "M", the menu shows/hides itself. The user can press "M" at any time during execution. Doesn't matter where in the program they press it..


I would do something like:
Create a backgroundworker/thread that checks for the press of the 'M' key while the program is active/visible on screen. When 'M' is pressed, the menu opens.. simple as that.
Basically a thread with a hotkey 'M'. Also you might wanna specify if your using .Net or just a plain old console program or Win32 API.

thanks man i got it working i found a thing called strcmp to compare chars together works like a charm. thanks :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.