PC SOFT

WINDEVWEBDEV AND WINDEV MOBILE
ONLINE HELP

Home | Sign in | English UK
  • Taking focus
  • ScreenFirst, SetFocus and ReturnToCapture
  • SetFocus applied to the last current control
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.
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).
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.
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.
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