PC SOFT

ONLINE HELP
FOR WINDEV, WEBDEV AND WINDEV MOBILE

Home | Sign in | English US

  • Gain of focus
  • ScreenFirst, SetFocus and ReturnToCapture
  • Error
  • ReturnToCapture on a window
  • ReturnToCapture on a Table control column
  • ReturnToCapture on the current control
  • ReturnToCapture on the last current control
  • Processes run when using ReturnToCapture
  • ReturnToCapture and END:
  • ReturnToCapture run in the "Before closing with OK/Close button" process
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadApple WatchUniversal Windows 10 AppWindows Mobile
Others
Stored procedures
Stops the current process and forces the input in the specified control, window or page.
WEBDEV - Browser code ReturnToCapture can be used in a browser event (onchange, onclick, ...) but it cannot be used in a browser local procedure or in a browser global procedure.
Versions 15 and later
Android This function is now available for the Android applications.
New in version 15
Android This function is now available for the Android applications.
Android This function is now available for the Android applications.
Versions 16 and later
Universal Windows 10 App This function is now available for the Windows Phone applications.
WINDEVLinux This function is now available for the WINDEV applications in Linux.
New in version 16
Universal Windows 10 App This function is now available for the Windows Phone applications.
WINDEVLinux This function is now available for the WINDEV applications in Linux.
Universal Windows 10 App This function is now available for the Windows Phone applications.
WINDEVLinux This function is now available for the WINDEV applications in Linux.
Example
// If no value was entered by the user in the control
IF EDT_Edit1 = "" THEN
// Display a message and position the user in edit on the control
Error("Enter a value")
ReturnToCapture(EDT_Edit1)
END
WINDEVReports and QueriesWindows MobileJavaUser code (UMC)
// Position the mouse cursor in a cell of a Table control (multiselection or not)
TABLE_Table_Name = Row_Subscript
ReturnToCapture(TABLE_Table_Name.COL_Column_Name)
Syntax
ReturnToCapture([<Object Name>])
<Object Name>: Optional character string (with or without quotes)
Name of control, column or window that will take focus (see Notes). If this parameter is not specified, the current control takes focus.
To specify a control belonging to a window other than the current window, <Object Name> must have the following format: <Window Name>.<Control Name>.
WEBDEV - Browser code Name of control or page that will take focus (see Notes). If this parameter is not specified, the last current control takes focus.
Versions 15 and later
AndroidUniversal Windows 10 App Name of the control or window that will take focus (see Notes). If this parameter is not specified, the current control takes focus.
New in version 15
AndroidUniversal Windows 10 App Name of the control or window that will take focus (see Notes). If this parameter is not specified, the current control takes focus.
AndroidUniversal Windows 10 App Name of the control or window that will take focus (see Notes). If this parameter is not specified, the current control takes focus.
Android Name of the control or window that will take focus (see Notes). If this parameter is not specified, the current control takes focus.
Remarks

Gain of focus

Taking "focus" is represented in different ways:
  • Blinking cursor (or "Caret") for the edit controls.
  • Dotted rectangle for the other types of controls (buttons, list boxes, radio buttons, ...).

ScreenFirst, SetFocus and ReturnToCapture

These functions have a different behavior:
  • ReturnToCapture stops the current process to force the input in the specified control.
  • ScreenFirst describes the next control that will be in edit (when the current code stops and when the input resumes).
  • SetFocus stops the current process, describes the next control that will be in edit and resumes the current process.

Error

A WLanguage error occurs if <Control Name> does not correspond to a control found in the current window or page.
WINDEVReports and QueriesAndroidWindows MobileJavaUser code (UMC)

ReturnToCapture on a window

If <Object Name> corresponds to a window name, the window is enabled. The control that will take focus in this window will correspond to:
  • the last control previously in edit in this window,
  • the first control that can take focus in this window (if no input was previously performed in this window).
WINDEVReports and QueriesWindows MobileJavaUser code (UMC)

ReturnToCapture on a Table control column

ReturnToCapture gives focus to the specified column. If the Table control is not currently in edit, the Table control becomes editable.
WINDEVReports and QueriesAndroidWindows MobileJavaUser code (UMC)

ReturnToCapture on the current control

ReturnToCapture used without parameter gives focus to the current control. This function, called in the exit code of edit control, is used to force the input in the current control if the information typed does not correspond to the expected information.
WEBDEV - Browser codeAjax

ReturnToCapture on the last current control

ReturnToCapture used without parameter gives focus to the last current control. This function, called in the exit code of edit control, is used to force the input in the current control if the information typed does not correspond to the expected information.
The control must be one of the following types of controls:
  • Edit control.
  • Check Box control.
  • Radio Button control.
  • List Box control.
  • Combo Box control.
  • Click Area control.
If the name of the control corresponds to a string that is built, the alias of the control must be used ("ControlAlias"+Num for example). In this case, no check is performed: JavaScript errors may occur if focus is given to a control that does not exist.
Reminder: The alias of a control corresponds to the name of this control in the HTML page. To find out this alias:
  • in the code editor, press SHIFT + F1.
  • by programming, use ..Alias.
WINDEVReports and QueriesAndroidWindows MobileJavaUser code (UMC)

Processes run when using ReturnToCapture

The WLanguage code that follows the call to ReturnToCapture is not run and the user takes control.
Special cases:
  • if the call to ReturnToCapture is performed in a code called by Execute, ExecuteCode or ExecuteProcess, the code called by Execute, ExecuteCode or ExecuteProcess is interrupted. The execution resumes after the call to Execute, ExecuteCode or ExecuteProcess.
  • if the call to ReturnToCapture is performed in the code of a function of a window other than the current window, the code of this function is interrupted and the execution resumes after its call.
  • if the call to ReturnToCapture is performed in the code of a component (procedure or method), the code of the component is interrupted and the execution resumes after the call to the procedure or method of the component.
  • if the call to ReturnToCapture is performed in a code of a procedure of internal window, the code of the procedure of the internal window is interrupted and the execution resumes after the call to the procedure of the internal window.
  • if the call to ReturnToCapture is performed in the code of a menu option, the code of the menu option is interrupted and the execution resumes after the call to the menu option.
  • if the call to ReturnToCapture is performed in a window procedure called from a supercontrol, the code of the procedure is interrupted and the execution resumes after the call to the procedure in the supercontrol.
  • if the call to ReturnToCapture is performed in a procedure of a supercontrol or control template, the code of the procedure is interrupted and the execution resumes after the call to the procedure of the supercontrol or control template.
The current process is permanently interrupted. For example:
ReturnToCapture("Edit1")
Info("XXX")    // Is never run
In most cases, the exit process (from the current control or window) and the entry process (in the specified control or window) are run at the same time as ReturnToCapture.
Exceptions:
  • No code is run if <Control Name> is the current control.
  • The exit code of the current control is not run if ReturnToCapture is used in one of the processes of this control.
To avoid interrupting the process, use ScreenFirst or SetFocus.
AndroidJava The WLanguage code that follows the call to ReturnToCapture is not run. The execution of processes resumes:
WINDEVReports and QueriesAndroidWindows MobileJavaUser code (UMC)

ReturnToCapture and END:

After a call to ReturnToCapture, the code following the "END:" statement is not run. ReturnToCapture can be replaced by the call to ScreenFirst followed by RETURN or RESULT.
Windows Mobile

ReturnToCapture run in the "Before closing with OK/Close button" process

If ReturnToCapture is called in the "Before closing with OK/Close button" process of a window, the current window will not be closed.
Note: The "Before closing with OK/Close button" process of a window is associated with the "Close" or "OK" button found in the title bar of the window.
Components
WINDEVReports and Queries wd230obj.dll
Windows Mobile wp230obj.dll
WEBDEV - Browser code WDJS.DLL
Java wd230java.jar
Linux wd230obj.so
Android wd230android.jar
Minimum required version
  • Version 9
This page is also available for…
Comments
Exemplo Fechar Window
//Global
gn_fechando_manual is int=0

//Closing
IF gn_fechando_manual=0 THEN
IF YesNo("Deseja Fechar Nota Fiscal") THEN
ELSE
ReturnToCapture(EDT_cliente_cnpj_cpf_codigo)
END
END


//Botao Fechar
gn_fechando_manual=1
Close(WIN_GeraNotaFiscal)

//Blog com Video e Exemplo
http://windevdesenvolvimento.blogspot.com.br/2016/03/windev21-curso-233-window-fechar-ou-nao.html
De matos AMARILDO
Mar. 17 2016