UI_DLG_CTL_GOTO()

Syntax

Result_Flag as L = UI_DLG_CTL_GOTO( Title as C, Control_Name as C )

Argument

Description

Result_Flag

Indicates whether the function succeeded.

  • .T. = Success

  • .F. = Failure

Title

The name of the dialog box.

Control_Name

The name of the control.

Description

The UI_DLG_CTL_GOTO() function sets focus to a control in a dialog.

Supported By

Alpha Five Version

Limitations

Desktop applications only.

Example

This example captures the setfocus event of F2 and returns the cursor to F1.

dim dlg_title as C = "Basic Modeless Dialog"

dim F1 as C

dim F2 as C

ui_modeless_dlg_box(dlg_title,<<%dlg%

{xmargin=10}

{ymargin=2}

If you place the cursor in Field Two, it will be moved to Field One;

{lf};

Field One [.25F1!F1];

Field Two [.25F2!F2_*];

{lf};

<20,2Close>;

%dlg%,<<%code%

if a_dlg_button="Close"

    ui_modeless_dlg_close(dlg_title)

end if

if (a_dlg_button="F1") then

    a_dlg_button = ""

end if

if (a_dlg_button="F2_Setfocus") then

    a_dlg_button = ""

    ui_msg_box("Incorrect Response","Moving the cursor to Field One")

    ui_dlg_ctl_goto(dlg_title, "F1")

end if

%code%)

This example sets the tabbing order of fields on a dialog.

dim dlg_title as C = "Custom tab order"
dim current_control as C = ""
dim target_control as C = ""

 

ui_dlg_box(dlg_title,<<%dlg%
{on_key=tab}
[textbox1];
[textbox2];
[textbox3];
[textbox4];
<close>
%dlg%,<<%code%

 

if a_dlg_button = "tab"
a_dlg_button = ""
current_control = alltrim(ui_dlg_ctl_current(dlg_title))
select
case current_control = "[textbox1]"
target_control = "[textbox4]"
case current_control = "[textbox2]"
target_control = "[textbox3]"
case current_control = "[textbox3]"
target_control = "[textbox1]"
case current_control = "[textbox4]"
target_control = "[textbox2]"
end select
ui_dlg_ctl_goto(dlg_title,target_control)

 

end if
%code%)

See Also

Xdialog Function Reference