PC SOFT

ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Home | Sign in | English EN
This content has been translated automatically. Click here to view the French version.
  • Focus gain
  • FirstScreen, SetFocus and UserFocusandReturn functions
  • SetFocus function on a column (Table control)
  • SetFocus on the current control
  • SetFocus on the last selected control
  • Processes executed when SetFocus is called
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadIOS WidgetApple WatchMac CatalystUniversal Windows 10 App
Others
Stored procedures
Set focus:
  • to a control (found in a window, in a page or in a frameset).
  • a window.
Versions 15 and later
Android This function is now available for Android applications.
New in version 15
Android This function is now available for Android applications.
Android This function is now available for Android applications.
Versions 16 and later
WINDEVLinux This function is now available for WINDEV applications in Linux.
New in version 16
WINDEVLinux This function is now available for WINDEV applications in Linux.
WINDEVLinux This function is now available for WINDEV applications in Linux.
Versions 17 and later
iPhone/iPad This function is now available for iPhone/iPad applications.
New in version 17
iPhone/iPad This function is now available for iPhone/iPad applications.
iPhone/iPad This function is now available for iPhone/iPad applications.
Example
// Donne le focus au champ SAI_Saisie1
SetFocus(SAI_Saisie1)
// Donne le focus au champ SAI_Saisie1 de
// la page/fenêtre "Inscription"
SetFocus(Inscription.SAI_Saisie1)
// Donne le focus au champ MonChamp
// présent dans le champ Zone répétée ZR_Client.
// Sélection de la seconde répétition
ZR_Client = 2
SetFocus(ZR_Client.MonChamp)
Syntax

Setting the focus on a control in the current window or page Hide the details

SetFocus([<Control name>])
<Control name>: Optional control name
Name of control (or column) that will gain focus (see the Notes). If this parameter is not specified, the current control gains 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 set on an Image control.
WEBDEV - Browser code Name of the control that must gain 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

Setting the focus on a control in a page of the current frameset (Internet Explorer only) Hide the details

SetFocus(<Page name>.<Control name>)
<Page name>: Character string
Name of the page containing the control that will gain focus.
<Control name>: Character string
Name of control that will gain 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/iPadIOS WidgetMac CatalystJavaUser code (UMC)

Give focus to a window Hide the details

SetFocus([<Window>])
<Window>: Optional window name
Name of window that will gain focus. This window will be enabled and the control gaining focus in this window will correspond to:
  • the last control previously in edit in this window.
  • the first control that can gain focus in this window (if no data was previously entered).
If this parameter is not specified, the current control gains focus.
Remarks

Focus gain

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

FirstScreen, SetFocus and UserFocusandReturn functions

These functions have a different behavior:
  • SetFocusAndReturnToUserInput 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).
  • The function SetFocus stops the current processing, describes what the next control with the entry will be and resumes the current processing.
WINDEVReports and QueriesJavaUser code (UMC)

SetFocus function on a column (Table control)

SetFocus sets the focus on the specified column. If the Table control is not receiving any input, it becomes editable.
WINDEVReports and QueriesAndroidiPhone/iPadIOS WidgetMac CatalystJavaUser code (UMC)

SetFocus on the current control

SetFocus used without parameters sets the focus on the current control. This function, called in the exit code of edit control, is used to force the input in the selected control if the information typed does not correspond to the expected information.
Windows

SetFocus on the last selected control

SetFocus used without parameters sets the focus on the current control. This function, called in the exit code of edit control, is used to force the input in the selected 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/iPadIOS WidgetMac CatalystJavaUser code (UMC)

Processes executed when SetFocus is called

As a rule, the output (of the current control or window) and input (into the specified control or window) processes are executed when the SetFocusfunction is called.
Exceptions:
  • No code is run if <Control name> is the current control.
  • The output code of the current control is not executed if the SetFocus function is used in one of the processes of this control.
Business / UI classification: UI Code
Component: wd270obj.dll
Minimum version required
  • 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
24 Sep. 2016