Tree View - FocusItem Property

Reference to the focus item in the list

Member of Tree View (PRIM_TRVW)

Data Type - PRIM_TVIT - Entry in a tree view


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.


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)

See also

All Component Classes

Technical Reference

LANSA Version 15, April 2020