Setting the Initial Focus

Description

By default the control that has focus when a dialog is opened is the first control on the dialog, however, you may specify a different control. The {initial_focus} command is used to do this. Here is an example where the third edit control in this dialog box gets the initial focus:

ui_dlg_box("Title",<<%dlg%
{region}
First|[.20first];
Second |[.20second];
Third |{initial_focus}[.20third];
Fourth|[.20fourth]
{endregion};
{region}
<*15&OK> <15&Cancel>
{endregion}
%dlg% )

Notice that the third control has focus.

images/XD_Initial_Focus.gif

Limitations

Desktop applications only

See Also