<< Click to Display Table of Contents >> Navigation: ThinBASIC Modules > UI (User Interface) > CONTROLS > Control Commands > CONTROL SET FOCUS |
Description
Change the active control on a dialog.
Syntax
CONTROL SET FOCUS hWnd, ctrlID
Returns
None
Parameters
Name |
Type |
Optional |
Meaning |
hWnd |
Number |
No |
Handle of the dialog containing the control |
CtrlID |
Number |
No |
Control identifier assigned to the control during CONTROL ADD ... |
Remarks
The control that owns the focus will receive all keyboard messages. Many controls change their appearance when they receive (and lose) keyboard focus, usually by the display of a "focus rectangle" around or on the control that has keyboard focus. Only one control can have keyboard focus at any moment, and situations can arise where no controls have focus.
Controls that include a "notify" style (i.e., %BS_NOTIFY) will receive a notification message when focus is gained or lost. That is, when one such control loses focus, it receives a message to that effect and the control gaining focus may also receive an appropriate focus notification message.
When a control gains focus the parent dialog will also be set as the foreground window.
Restrictions
CONTROL SET FOCUS cannot be used to set the focus of a control in a separate thread.
See also
Examples