Focusing a CEdit Object in a Dialog On Startup :: MFC

kuphryn

Senior member
Jan 7, 2001
400
0
0
Hi.

I have a dialog box. When Windows draws the dialog box, I want to to focus to a specific CEdit object (window). For example, let say the dialog box asks the user for a username and password. I would like Windows to focus the username window when it first draws the dialog box.

What is the best way to do that?

Thanks,
Kuphryn
 

singh

Golden Member
Jul 5, 2001
1,449
0
0
In OnInitDialog(), call the member's SetFocus() method, and return FALSE so MFC won't focus a control for you.
 

kuphryn

Senior member
Jan 7, 2001
400
0
0
Thanks.

I presume that applies to modal dialog box and modeless dialog box.

Kuphryn