Grid - FocusItem Property

Reference to the focus item in the list

Member of Grid (PRIM_GRID)

Data Type - PRIM_GDIT - Entry in a grid

Details

The FocusItem is the item in the list that will react to keyboard input.
 
There is only ever one focus item and it is usually that last item clicked or accessed via the arrow keys.
 
When the FocusItem is set the list will fire an ItemGotFocus event. If focus moves to another item, an ItemLostFocus will be fired first.
 
If the FocusItem is deleted, the list will assign focus to an arbitrary item, typically the first.
 
FocusItem and CurrentItem may well be different and it is CurrentItem that updates the field values in the component. Before using FocusItem, it is best practice to ensure that both the CurrentItem and FocusItem are the same. This will ensure that field values are up to date.
 
Lists may not have a focus item, so it is prudent to check before using it.

Example

Testing for a focus item before making it the CurrentItem by using GET_ENTRY.
If (#List.FocusItem *isnot *null)
 
   Get_Entry Number(#List.FocusItem.Entry) From_List(#List)
 
Endif

See also

All Component Classes

Technical Reference

Febuary 18 V14SP2