List - FocusItem Property

Reference to the focus item in the list

Member of List (PRIM_LIST)

Data Type - PRIM_LIST.ListItem - List Item

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. These events correspond to the OnItemGotFocus and OnItemLostFocus methods on the Prim_List.iListCellDesign interface.
 
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