Focus Problem
-
I've a MFC dialog with two edit boxes... By default focus in on first text box. I want that during dialog load if first edit box contains some text, then second edit box should have focus... I've tried SetFocus() in InitDialog() but it's not working... focus still remains on first control. How should I do it? Please Help!
-
I've a MFC dialog with two edit boxes... By default focus in on first text box. I want that during dialog load if first edit box contains some text, then second edit box should have focus... I've tried SetFocus() in InitDialog() but it's not working... focus still remains on first control. How should I do it? Please Help!
-
I've a MFC dialog with two edit boxes... By default focus in on first text box. I want that during dialog load if first edit box contains some text, then second edit box should have focus... I've tried SetFocus() in InitDialog() but it's not working... focus still remains on first control. How should I do it? Please Help!
-
I've a MFC dialog with two edit boxes... By default focus in on first text box. I want that during dialog load if first edit box contains some text, then second edit box should have focus... I've tried SetFocus() in InitDialog() but it's not working... focus still remains on first control. How should I do it? Please Help!
In addition to what NS17 stated, you should also use GotoDlgCtrl() instead of SetFocus() when setting the focus to edit controls. Mark
Mark Salsbery Microsoft MVP - Visual C++ :java:
-
I've a MFC dialog with two edit boxes... By default focus in on first text box. I want that during dialog load if first edit box contains some text, then second edit box should have focus... I've tried SetFocus() in InitDialog() but it's not working... focus still remains on first control. How should I do it? Please Help!
If you change the focus in OnInitDialog() to something other than the first control, make sure that your OnInitDialog() handler returns FALSE. If it returns TRUE, the default Window handler sets the focus for you, overriding anything you did.
Software Zen:
delete this;