Focus object

4D - Documentation   Français   English   German   4th Dimension 2004, Command Theme List   4th Dimension 2004, Command Alphabetical List   4th Dimension 2004, Constant Theme List   Back   Previous   Next

version 2004 (Modified)


Focus object Pointer

ParameterTypeDescription
This command does not require any parameters
Function resultPointerPointer to the object having the focus

Description

Focus object returns a pointer to the object having the focus in the current form. If no object has the focus, the command returns Nil. 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 type object, the Focus object function returns a pointer to the column (the array) of the list box that has the focus.

This command cannot be used with fields in subforms.

Note: This command is to be used only in data entry context, otherwise it will return errors.

Example

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($pointer))  ` 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

4D - Documentation   Français   English   German   4th Dimension 2004, Command Theme List   4th Dimension 2004, Command Alphabetical List   4th Dimension 2004, Constant Theme List   Back   Previous   Next