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. By using the website, you agree with storing cookies on your computer. Also you acknowledge that you have read and understand our Privacy Policy. If you do not agree leave the website.More information about cookies
setting_20the_20focus_20in_20a_20dialogue_20box.txt · Last modified: 2024/01/05 00:21 by 127.0.0.1