User Tools

Site Tools


setting_20the_20focus_20in_20a_20dialogue_20box

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
setting_20the_20focus_20in_20a_20dialogue_20box [2018/03/31 13:19] – external edit 127.0.0.1setting_20the_20focus_20in_20a_20dialogue_20box [2024/01/05 00:21] (current) – external edit 127.0.0.1
Line 1: Line 1:
 =====Setting the focus in a dialogue box===== =====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 [[http://www.bbcbasic.co.uk/bbcwin/manual/bbcwing.html#newdialog|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:\\ +//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 [[http://www.bbcbasic.co.uk/bbcwin/manual/bbcwing.html#newdialog|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: 
 + 
 +<code bb4w> 
         WM_NEXTDLGCTL = 40         WM_NEXTDLGCTL = 40
         SYS "GetDlgItem", !dlg%, id% TO hdlgctl%         SYS "GetDlgItem", !dlg%, id% TO hdlgctl%
         SYS "PostMessage", !dlg%, WM_NEXTDLGCTL, hdlgctl%, 1         SYS "PostMessage", !dlg%, WM_NEXTDLGCTL, hdlgctl%, 1
 +</code>
 +
 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. 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)