PC SOFT

WINDEVWEBDEV AND WINDEV MOBILE
ONLINE HELP

Home | Sign in | English UK
  • 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
Set focus:
  • to a control (found in a window, in a page or in a frameset).
  • a window.
Example
// Set focus to the EDT_Edit1 control
SetFocus(EDT_Edit1)
// Set focus to the EDT_Edit1 control in
// the "Registration" page or window
SetFocus(Registration.EDT_Edit1)
// Set focus to MyControl
// found in the LOOP_Customer Looper control.
// Select the second 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.
Java No focus can be set to an Image control.
WINDEVJavaUser 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, etc.).
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.
WINDEVJavaUser code (UMC)

SetFocus applied to a column (Table control)

SetFocus sets focus to the specified column. If the Table control is not currently in edit, the Table control becomes editable.
WINDEVJavaUser code (UMC)

SetFocus applied to the current control

SetFocus used without parameter sets 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 sets focus to the last 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.
WINDEVJavaUser 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.
Component : wd240obj.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