The last item in the list touched either in the UI or via a list related command
Member of Grid (PRIM_GRID)
Data Type - PRIM_GDIT - Entry in a grid
CurrentItem is the item in the list that was last touched either by the mouse, keyboard or a LANSA list command such as SELECTLIST or GET_ENTRY. When CurrentItem is set, the field values associated with the list definition will be returned to the component. This ensures that the field values for the last item are correct when the event is fired. Care is required when relying on CurrentItem to identify the item last clicked. This will actually be the FocusItem and it won't change until another item is clicked. CurrentItem however can be affected by a simple MouseOver. Currentitem is best suited to processing directly related the list e.g. DoubleClick events or SELECTLIST. When dealing with actions driven by external sources, for example a button click to process the last item, using FocusItem is recommended. Using the FOR command to iterate over the items in a list will not affect CurrentItem.
Using CurrentItem to set the image for the last item added to a list.
Add_Entry To_List(#List) #List.CurrentItem.Image <= #Image1
Using CurrentItem in a SELECTLIST loop to check item state. Here the selected items in the list are being totalled.
SelectList Named(#List) Continue (*Not #Item.Selected) #TotalSalary += #Salary EndSelect
Using the FOR command iterates over the items in their sorted sequence, but CurrentItem will not be set. Use GET_ENTRY to set the CurrentItem to ensure field values are returned to the component.
For Each(#Item) in(#List.Items) Get_Entry Number(#Item.Entry) From_List(#List) * User processing here EndFor
LANSA Version 15, April 2020