Hello, i'm implemeting a vertical list to display items from an array.
I want a list of receipts, every receipt has it's own properties like : receipt name, settings etc...
In the init method of the screen where the vertical list is i set the name of the array entries to a default value (1,2,3....)
// TO DO: Write your code here ...
var int32 i = 0;
for(i=0 ; i< Application::GlobalSettings.ReceiptArray.size ; i=i+1)
{
Application::GlobalSettings.ReceiptArray[i].NomeRicetta = string (i);
}
When Scrolling, the value set by the init method changes to the default value of the item class ( wich is an "#"_), when the disappear and get reloaded.
Initially looks fine
Scrolling down after the 8th item it gets like this:
Then when scrolling Back to top 1st and 2nd item get default.
Then scrolling back and forth they get all to the default value of the item class.
This is the onLoadItem method:
/*
Hint:
- The code below demonstrates a simple usage of the list component.
- The list component creates and manages automatically view item instances of
the class specified in its property 'ItemClass'. In this example it is the
class 'Views::Text'.
- When you change the 'ItemClass' property you will also need to replace
accordingly all 'Views::Text' occurrences in the below code.
- You will also need to adapt the initialization of the 'itemView'.
*/
// Get the number of the item to load. The list component takes care of the
// creation of the corresponding item view. Just access it ...
var int32 itemNo = VerticalList.Item;
var Application::ReceiptProgram itemView = (Application::ReceiptProgram)VerticalList.View;
// The implementation of this slot method does not match the item class
// specified in the associated list component. Or the slot method is not
// called in context of the OnLoadItem list operation.
if ( itemView == null )
return;
// Configure the item view ...
itemView.NomeRicetta = "Prog. " + Application::GlobalSettings.ReceiptArray[itemNo].NomeRicetta;
// Ensure that the item has correct size. The position of the item will be
// managed by the list component.
itemView.Bounds.size = VerticalList.ViewSize;