User Tools

Site Tools


setting_20the_20focus_20in_20a_20dialogue_20box

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.

This website uses cookies for visitor traffic analysis. By using the website, you agree with storing the cookies on your computer.More information
setting_20the_20focus_20in_20a_20dialogue_20box.txt · Last modified: 2018/04/15 17:27 by richardrussell