ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Help / WLanguage / WLanguage functions / Controls, pages and windows / Control functions
  • Focus gain
  • ScreenFirst, SetFocus and SetFocusAndReturnToUserInput
  • SetFocus on the last selected control
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.
Example
// Set focus on the EDT_Edit1 control
SetFocus(EDT_Edit1)
// Set focus on the EDT_Edit1 control in
// the "Registration" page or window
SetFocus(Registration.EDT_Edit1)
// Set focus on MyControl
// found in the LOOP_Customer Looper control.
// Select the second row
LOOP_Customer = 2
SetFocus(LOOP_Customer.MyControl)
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.
WEBDEV - Browser code Name of the control that must gain focus (see "Remarks"). If this parameter is not specified, a compilation error appears. 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([<Control in the page>])
<Control in the page>: Character string
Name of the control that will gain focus in the page. This parameter has the following format:
<Page name>.<Control name>
where:
  • <Page name> is the name of the page containing the control that will gain focus.
  • <Control name> is the name of the 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).
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).

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.
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.
Business / UI classification: UI Code
Component: wd290obj.dll
Minimum version required
  • Version 9
This page is also available for…
Comments
Click [Add] to post a comment

Last update: 05/26/2022

Send a report | Local help