Jump to content
  • Advertisement
Sign in to follow this  
Dookie

Windows question: moving focus between controls

This topic is 4320 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello, it's me again! I've got a quick question for an editor I'm working on, and it's coded in plain old Windows controls (dialogbox, buttons, edit controls, etc). I'm working on a simple dialogbox that has some buttons and a text input box. You type in something, and you push a button to 'enter' the data. You can push another button to 'exit' the program. However, I'd like it to where I can type in something in the text input box and then hit ENTER key on the keyboard, and it would know which button to push when ENTER was pushed. I played around with the tab order (made the text box 1, made the 'enter' button 2, made the 'exit' button 3, and so on) but that didn't work... I can click in the text input box and type something in it, then press ENTER and sometimes it would exit because the focus would go to the 'exit' button instead of the 'enter' button! I don't know how to get the focus to always go to the 'enter' button when I'm typing something in the text input box... Can somebody help me on this one? Thanks in advance for the help! [smile]

Share this post


Link to post
Share on other sites
Advertisement
Actually the Enter key is the same thing clicking the OK button, and escape is the same as clicking cancel. So you need to override OnOk and OnCancel processing for your dialog box to capture these two keys. Nothing else will work.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!