$fieldhandle

Return a partner handle to the widget that is currently bound to the specified field of the current occurrence.

$fieldhandle { (Field) }

Parameters

Parameters
Parameter Data Type Description
Field String Field name. If omitted, the current field is used.

Return Values

  • Partner Handle of the field.
  • A NULL handle is returned if Field is not a valid field, or if an error occurs during the evaluation of this function. $procerror contains a negative value that identifies the exact error.
Values Commonly Returned by $procerror after $fieldhandle and $widgetoperation
Value Error constant Meaning
-1101 UPROCERR_FIELD An incorrect field name was provided; either the field name is not valid syntactically or the field is not available in the component.

-1113

PROCERR_PARAMETER Parameter is not valid, for example, an empty string ("")
-1118 UPROCERR_ARGUMENT The argument specified is incorrect. For example, there is no mapping between the Uniface and JavaScript data type of a parameter.
-1120 UPROCERR_OPERATION The operation name provided is not valid.
-1123 UPROCERR_NPARAMETERS Wrong number of parameters
-1418 UPROCERR_FIELD_NOT_VISIBLE Field is not visible
-1419 UPROCERR_WIDGETOPERATION Widget operation not valid

Use

Use in Form components.

Description

By definition, a widget is fixed to the screen and is always in view, whereas fields are part of the occurrences in the hitlist. Scrolling through multiple occurrences causes a different field (and its data and properties) to be bound to the widget as the data is scrolled. Thus, $fieldhandle creates a partner handle for the widget that is currently bound to the current occurrence of a field.

To get handles to multiple occurrences, you need to use setocc before $fieldhandle. For example:

;vHandle1 and vHandle2 are variables of type partner handle

; get handle of F1 in the first occurrence:
setocc "ENT.MODEL", 1
vHandle1 = $fieldhandle(F1) 

; get handle of F1 in the third occurrence:
setocc "ENT.MODEL", 3
vHandle2 = $fieldhandle(F1) 

Handles are usually used to activate operations on the referenced object. However, the $fieldhandle function is used only to access widget operations via the special $widgetoperation function:

$fieldhandle(Field)->$widgetoperation(WidgetOperation{,Params})

Some widgets have predefined widget operations which can be invoked using $fieldhandle. These operations enable you to manipulate the content of the widget, which is not necessarily the same as the content of the field. For more information, see $widgetoperation .

Version Change
9.6.01 Introduced

Related Topics