I'm working on my first simple MFC project, but I'm struggling with one problem: want to set the focus of all CEdit
boxes in one of the dialogs. My idea is when open the dialog, the focus to be on the first edit box and then to swap between them with 'tab'.
I saw the method SetFocus()
, but I couldn't apply it correctly. Also I couldn't find a solution for implementing the order of the focus with a specific key.
Thanks in advance to everybody who takes time to help me!
You can set the focus to a given control when your dialog box is first shown by calling
SetFocus
in yourOnInitDialog()
function. However, if you do so, yourOnInitDialog()
must returnFALSE
:From the M/S documentation: