Xbasic
UI_DLG_CTL_GOTO Function
Syntax
Result_Flag as L = UI_DLG_CTL_GOTO(C title,C control)
Arguments
- Result_Flag
Indicates whether the function succeeded. .T. = Success .F. = Failure
- title
The name of the dialog box.
- control
The name of the control.
Description
Goto a control in the open dialog, return TRUE if succeeded.
Discussion
The UI_DLG_CTL_GOTO() function sets focus to a control in a dialog.
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]; %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%)
Limitations
Desktop applications only.
See Also