I have a simple dialog app which has 1 single line edit box and a couple of buttons on it.
Id like to place the cursor in it when the app opens, but most importantly, the edit box shouldn’t loose the cursor, even it the user clicks a 'reset' button. The idea being that whenever the user starts to type, the cursor will be in the edit box.
Use SetFocus() in the OnInitDialog()
Be sure to return false from the dialog or it won't work.
In the on-click handler for the reset button (and any other buttons), set the focus back to the editcontrol also.
You could force the editcontrol to always have focus by overriding the OnSetFocus() and generically reforcing focus to the editcontrol, but this will mean normal tab-behaviour will fail. A user won't be able to tab to the reset button to 'click' it that way in case they have no mouse (or prefer not to use a mouse).