I developed a simple example about how I think you should handle easily views and values of a CustomListView item.
3 things:
1) constants pointing to the views order in the item;
2) two custom types, one for the views and the other for the values;
3)four functions (you can find them in a Region named "GET CLV ITEM STUFF"):
[EDIT] Now they are two functions only, version 2.
The test is not so smart, but it's about 4:00 AM, don't expect too much :
1) check / uncheck the Sold checkbox.
The item values will be get by view (the checkbox) and shown (ToastMessageShow and log);
2) set focus on some Description EditText.
Here the views will be get two times:
first time by view (you will see change the beer and the Code text);
second time, after 1.5 sec., by index (cancel previous changes)
I hope you like it.
Maybe I'll look for a way to make this more generic.
Tips to improve this thing will be very welcome.
[NOTE: I added GetDividerHeight to the CustomListView]
Attached Version 2: see my posts #2 and #3.
3 things:
1) constants pointing to the views order in the item;
2) two custom types, one for the views and the other for the values;
3)
[EDIT] Now they are two functions only, version 2.
B4X:
' Returns views of item at the given item index.
Sub GetItemViewsByIndex(ItemIndex As Int) As tItemViews 'ignore
B4X:
' Returns views of item that contains the given View.
' USES: function GetItemViewsByIndex
Sub GetItemViewsByView(Vw As View) As tItemViews 'ignore
B4X:
' Returns values of item at the given item index.
' USES: function GetItemViewsByIndex
Sub GetItemValuesByIndex(ItemIndex As Int) As tItemValues 'ignore
B4X:
' Returns values of item that contains the given view.
' USES: function GetItemValuesByIndex
Sub GetItemValuesByView(Vw As View) As tItemValues 'ignore
The test is not so smart, but it's about 4:00 AM, don't expect too much :
1) check / uncheck the Sold checkbox.
The item values will be get by view (the checkbox) and shown (ToastMessageShow and log);
2) set focus on some Description EditText.
Here the views will be get two times:
first time by view (you will see change the beer and the Code text);
second time, after 1.5 sec., by index (cancel previous changes)
I hope you like it.
Maybe I'll look for a way to make this more generic.
Tips to improve this thing will be very welcome.
[NOTE: I added GetDividerHeight to the CustomListView]
Attached Version 2: see my posts #2 and #3.
Attachments
Last edited: