setting_20the_20focus_20in_20a_20dialogue_20box
This is an old revision of the document!
Setting the focus in a dialogue box
by Richard Russell, May 2010
If you want to initialise a dialogue box so that the input focus is on a particular control, simply make that control the first in the template (i.e. the first to be created after calling FN_newdialog). By default the first control always gains the initial focus.
However if you want to move the input focus to a different control, once the dialogue box has been opened, you should do that using the following code:
WM_NEXTDLGCTL = 40 SYS "GetDlgItem", !dlg%, id% TO hdlgctl% SYS "PostMessage", !dlg%, WM_NEXTDLGCTL, hdlgctl%, 1
where dlg% is the value returned from FN_newdialog and id% is the ID of the control that you want to receive the input focus.
setting_20the_20focus_20in_20a_20dialogue_20box.1522502381.txt.gz · Last modified: 2024/01/05 00:16 (external edit)