ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

This content has been translated automatically.  Click here  to view the French version.
Help / WLanguage / WLanguage functions / Controls, pages and windows / Control functions
  • Focus gain
  • ScreenFirst, SetFocus and SetFocusAndReturnToUserInput
  • SetFocus on a Table control column
  • SetFocus on the current control
  • SetFocus on the last selected control
  • Processes executed when SetFocus is called
WINDEV
WindowsLinuxJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadIOS WidgetApple WatchMac Catalyst
Others
Stored procedures
Set focus:
  • to a control (in a window, in a page or in a frameset).
  • a window.
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 "Remarks"). 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.
Reports and Queries

Setting the focus to a window Hide the details

SetFocus([<Window>])
<Window>: Optional window name
Name of the 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.).
Please note Not all field types (e.g. "label" fields) can take focus.

ScreenFirst, SetFocus and SetFocusAndReturnToUserInput

These functions have a different behavior:
  • SetFocusAndReturnToUserInput stops the current process to force the input in the specified control.
  • ScreenFirst defines which control will receive input focus (when the current code stops and input focus is set back to a control).
  • SetFocus stops the current process, defines which control will receive input focus and resumes the current process.
Reports and Queries

SetFocus on a Table control column

SetFocus sets the focus on the specified column. If the Table control is not receiving any input, it becomes editable.
Reports and Queries

SetFocus on the current control

SetFocus used without parameters sets the focus on the current control. This function, called in the exit code of an Edit control, is used to force the input in the selected control if the data entered and the expected data do not match.
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 an Edit control, is used to force the input in the selected control if the data entered and the expected data do not match.
The control type must be:
  • edit control.
  • Check Box control.
  • Radio Button control.
  • List Box control.
  • Combo Box control.
  • Click Area control.
Reports and Queries

Processes executed when SetFocus is called

In most cases, the exit process (from the current control or window) and the entry process (in the specified control or window) are executed when SetFocus is called.
Exceptions:
  • No code is executed if <Nom du champ> is the current field.
  • The exit code of the selected control is not executed if SetFocus is used in one of the WLanguage events associated with this control.
Business / UI classification: UI Code
Component: wd300obj.dll
Minimum version required
  • Version 9
This page is also available for…
Comments
Click [Add] to post a comment

Last update: 03/27/2025

Send a report | Local help