This is the legacy 4D documentation web site. Documentations are progressively being moved to developer.4d.com |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
4D v20.6
Focus object
|
Focus object -> Function result | ||||||||
Parameter | Type | Description | ||||||
Function result | Pointer |
![]() |
Pointer to the object having the focus | |||||
This command is kept only for compatibility reasons. Starting with version 12 of 4D, it is recommended to use the OBJECT Get pointer command.
Focus object returns a pointer to the object having the focus in the current form. If no object has the focus, the command returns Is nil pointer. You can use Focus object to perform an action on a form area without having to know which object is currently selected. Be sure to test that the object is the correct data type, using Type, before performing an action on it.
Note: When it is used with a list box, the Focus object function returns a pointer to the list box or the column of the list box depending on the context. For more information, please refer to the Managing List Box Objects section.
This command cannot be used with fields in subforms.
Note: This command is to be used only in a data entry context; otherwise it will return errors.
The following example is an object method for a button. The object method changes the data in the current object to uppercase. The object must be a text or string data type (type 0 or 24):
$vp :=Focus object //Save the pointer to the last area
Case of
:(Nil($vp)) //No object has the focus
...
:((Type($vp->)=Is alpha field)|(Type($vp->)=Is string var)) //If it is a string or text area
$vp->:=Uppercase($vp->) //Change the area to uppercase
End case
Product: 4D
Theme: User Interface
Number:
278
Modified: 4D v11 SQL
4D Language Reference ( 4D v20)
4D Language Reference ( 4D v20.1)
4D Language Reference ( 4D v20.2)
4D Language Reference ( 4D v20.3)
4D Language Reference ( 4D v20.4)
4D Language Reference ( 4D v20.5)
4D Language Reference ( 4D v20.6)