• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 581
  • Last Modified:

How to SetFocus on a CEdit box so that the user can just start typing when the dialog loads?

Hello everyone,

I have a dialog that opens when a user opens my application asking them for their username/password. I want to have the focus set on the USERNAME CEdit box when the dialog loads so that the user doesn't have to click on the USERNAME box to type in their text.

The focus should be set on load so they can just type in their name.

How can I do this? Any comments or pointing in the right direction is appreciated.
  • 2
1 Solution
The easiest way - set that CEdit as the initially focused (default) control for that dialog using the resource editor.
VirtueTechAuthor Commented:
I don't see a way to set it as the initially focused control.

Is this in the CEdit box's properties?

Sorry for the newb question
In dialog editor Select Layout - Tab Order in the menu and click dialog controls in desired order. First should be this edit box.
BTW, setting focus programmatically is done using GotoDlgCtrl function.
VirtueTechAuthor Commented:
Wow...that was cool..and pretty easy. Thanks.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now