PC SOFT

ONLINE HELP
FOR WINDEV, WEBDEV AND WINDEV MOBILE

Home | Sign in | English US
  • Taking focus
  • ScreenFirst, SetFocus and ReturnToCapture
  • SetFocus applied to a column (Table control)
  • SetFocus applied to the current control
  • SetFocus applied to the last current control
  • Processes run when using SetFocus
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
Gives focus:
  • to a control (found in a window, in a page or in a frameset).
  • to a window.
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.
Versions 17 and later
iPhone/iPad This function is now available for the iPhone/iPad applications.
New in version 17
iPhone/iPad This function is now available for the iPhone/iPad applications.
iPhone/iPad This function is now available for the iPhone/iPad applications.
Example
// Gives focus to the EDT_Edit1 control
SetFocus(EDT_Edit1)
// Gives focus to the EDT_Edit1 control in
// the "Registration" page or window
SetFocus(Registration.EDT_Edit1)
// Gives focus to MyControl
// found in the LOOP_Customer looper.
// Select the 2nd row
LOOP_Customer = 2
SetFocus(LOOP_Customer.MyControl)
Syntax

Giving focus to a control found in the current window or page Hide the details

SetFocus([<Control Name>])
<Control Name>: Optional character string (with or without quotes)
Name of control (or column) that will take focus (see the Notes). If this parameter is not specified, the current control takes focus.
A WLanguage error occurs if <Control Name> does not correspond to a control found in the current window or in the current page.
AndroidJava No focus can be given to an Image control.
WEBDEV - Browser code Name of the control that must take focus (see the Notes). If this parameter is not specified, a compilation error is triggered. If this parameter is a built string (for example: "Control" + sControlNum), no check regarding the existence of the control is performed (a Javascript error will be displayed in the browser if the specified control does not exist).
WEBDEV - Browser code

Giving focus to a control found in a page of the current frameset (Internet Explorer only) Hide the details

SetFocus(<Page Name>.<Control Name>)
<Page Name>: Character string (with or without quotes)
Name of the page containing the control that will take focus.
<Control Name>: Character string (with or without quotes)
Name of control that will take focus. If this parameter is a built string (for example: "Control" + sControlNum), no check regarding the existence of the control is performed (a Javascript error will be displayed in the browser if the specified control does not exist).
WINDEVReports and QueriesAndroidiPhone/iPadWindows MobileUniversal Windows 10 AppJavaUser code (UMC)

Giving focus to a window Hide the details

SetFocus([<Window Name>])
<Window Name>: Optional character string (with or without quotes)
Name of window that will take focus. This window will be enabled and the control taking 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).
If this parameter is not specified, the current control takes focus.
Remarks

Taking 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, ...).
Caution: Some types of controls cannot take focus ("static" controls for example).

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.
WINDEVReports and QueriesWindows MobileJavaUser code (UMC)

SetFocus applied to a column (Table control)

SetFocus gives focus to the specified column. If the Table control is not currently in edit, the Table control becomes editable.
WINDEVReports and QueriesAndroidiPhone/iPadWindows MobileUniversal Windows 10 AppJavaUser code (UMC)

SetFocus applied to the current control

SetFocus 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.
Windows

SetFocus applied to the last current control

SetFocus 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 type must be:
  • edit control.
  • Check Box control.
  • Radio Button control.
  • List Box control.
  • Combo Box control.
  • Click Area control.
WINDEVReports and QueriesAndroidiPhone/iPadWindows MobileUniversal Windows 10 AppJavaUser code (UMC)

Processes run when using SetFocus

In most cases, the exit process (from the current control or window) and the entry process (in the specified control or window) are run when SetFocus is called.
Exceptions:
  • No code is run if <Control Name> is the current control.
  • The exit code of the current control is not run if SetFocus is used in one of the processes of this control.
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
Posicionar No final DO campo para digitacao
Posicionar No final DO campo para digitacao

n_tamanho_cnpj_i,n_tamanho_cnpj_f,n_tamanho_inscricao_est_i,n_tamanho_inscricao_est_f is int=0
s_texto is string="Cnpj:"
n_tamanho_cnpj_i=Length(s_texto)
s_texto+="92.715.978.0001-58 "
n_tamanho_cnpj_f=Length(s_texto)
s_texto+=CR+"Insc.Est: "
n_tamanho_inscricao_est_i=Length(s_texto)
s_texto+="Isento"
n_tamanho_inscricao_est_f=Length(s_texto)
s_texto+=CR+"======================"
EDT_RTF_Text=s_texto
EDT_RTF_Text..Cursor=n_tamanho_cnpj_i
EDT_RTF_Text..CursorEnd=n_tamanho_cnpj_f
RTFSelection(EDT_RTF_Text,rtfColor,LightBlue)
EDT_RTF_Text..Cursor=n_tamanho_inscricao_est_i
EDT_RTF_Text..CursorEnd=n_tamanho_inscricao_est_f
RTFSelection(EDT_RTF_Text,rtfColor,LightMagenta)
//No Final das Linhas vou Digitar
n_inicio_digitacao is int=Length(EDT_RTF_Text)
//Agora é o segredo
EDT_RTF_Text..Cursor=n_inicio_digitacao+1
SetFocus(EDT_RTF_Text)

// Blog com video e Exemplo
http://windevdesenvolvimento.blogspot.com.br/2016/09/curso-windev-string-021-posicionar.html
https://www.youtube.com/watch?v=pJqPJr0-PrU
De matos
Sep. 24 2016